Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
package.json `babel.presets` not working... #745
Comments
|
What's the reason for using the |
|
Because it's got a non-standard name (e.g. not |
|
Hey, any advice on this? |
|
Sorry about the delay - are you able to give a bit more information about your project's file structure? I'm curious if this is a package.json in the working directory, or if microbundle is being executed from another package.json (since it seems like you're in a monorepo). We don't crawl for Babel presets at all, they are only respected if they are defined in the working directory. |
|
Hey, I'm not in a monorepo. I've actually been migrating out of one. Regarding the babel preset, I use it across a handful of projects without a problem, sometimes in {
"name": "@sitearcade/request",
"sideEffects": false,
"source": "src/index.js",
"main": "./dist/index.js",
"jsnext:main": "./dist/index.modern.js",
"module": "./dist/index.module.js",
"syntax": {
"esmodules": "./dist/index.modern.js"
},
"exports": {
".": {
"browser": "./dist/index.module.js",
"import": "./dist/index.module.js",
"require": "./dist/index.js"
}
},
"files": [
"dist"
],
"scripts": {
"start": "microbundle watch --no-compress -f cjs,esm,modern",
"build": "microbundle --no-compress -f cjs,esm,modern"
},
"dependencies": {},
"devDependencies": {},
"engines": {
"node": ">=10"
},
"babel": {
"presets": [
"module:@sitearcade/babel-preset"
]
}
} |
I use a shared babel-preset across projects, which I reference from a third party repo. It typically works in package.json as:
{ "babel": { "presets": [ "module:@namespace/babel-preset" ] }, }However, microbundle seems to be silently ignoring it. I get an issue using the pipeline operator. In order for it to detect that plugin, I need to reference it explicitly. But I can't see how I can configure plugins in
package.jsonbut not presets unless microbundle is doing something strange under the hood:{ "babel": { "presets": [ "module:@sitearcade/babel-preset" ], "plugins": [ ["@babel/plugin-proposal-pipeline-operator", {"proposal": "smart"}] ] }, }I should add, when running jest (with babel-jest), my preset gets picked up fine.
Any idea what's going on here?