-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(babel): merges babelrc with microbunde babel config #396
Conversation
2ba0f92
to
61937cf
Compare
So wait, if someone puts a babelrc in their project dir it gets overridden with our defaults? |
Let me try to explain a bit better. microbundle/src/lib/babel-custom.js Lines 55 to 76 in 555af26
The same principle goes for microbundle/src/lib/babel-custom.js Lines 91 to 112 in 555af26
Does this explains it better? |
yeah that explains it, ideal would be if we could have a preset like but I guess we'll want to override at least the modules stuff either way |
I don't think we need a babel preset. I don't see a big issue with merging what we do now. The only problem that I might see is we always exclude |
not sure if that's really a problem either |
hmm, broke tests with #347 |
let me fix this :) |
it's a bit weird, not sure if I should just update the snapshots |
* feat(babel): merges babelrc with microbunde babel config * update tests * Fix README.md Fix examples description * remove unused rollup-plugin-flow dependency (#379)
The issue I can see with merging the config is that it's a bit "magical" and ambiguous. With a custom babel preset it would be very clear what's happening and the end user could still customize the other preset options (exclude etc). There are no cases where you want to be able to completely override the default config? Anyway great work on this! 😄 |
I'm using
Would the merging of this |
@briancodes you mostly want to use babel env to fix this. There are 2 options setting BABEL_ENV=test or NODE_ENV=test. in babelrc you can create this config: {
"env": {
"test": {
presets: ['@babel/preset-env', { "node": "current", "modules": false }]
}
}
} |
Enables custom babelrc files to get merged with our babelrc file. By default babel already does this if presets/plugins do not exists. With this PR we merge them together.
For
@babel/preset-env
I've done a special merge as we want to make suretransform-async-to-generator
is excluded and modules is set to false.This allows people to set
@babel/preset-env
with babel-polyfill as many applications do. This is less relevant for libraries unless they want to ship a few polyfills magically.Another change that has been added is we only run the node_modules babel transform when the
defines
option is set. (I think it should speed up microbundle a bit if people aren't using it)