-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Configuring the babel loader is not possible when using babelrc file #543
Comments
my use case for using an external config file is that |
Oh, and of course, my project requires me to include some node modules in what gets processed by Babel (the material-components-web packages which use ES6 syntax in the modules), so I need the configuration of options. |
Not related to your issue, but:
Should we deprecate this functionality in favour of #509? |
Well, I still like the |
…iguration (Lyrkan, weaverryan) This PR was squashed before being merged into the master branch (closes #544). Discussion ---------- Allow to call configureBabel with an external Babel configuration This PR fixes #543 by allowing to call `Encore.configureBabel()` even if an external Babel configuration exists. Basically: * `null` (or any falsy value in reality, to keep it simple) is always allowed as a first argument * a warning will be displayed if the first argument is a callback and something like a `.babelrc` file is detected * a warning will be displayed if the second argument contains a non-whitelisted option (ie. not `includeNodeModules`/`exclude`) and something like a `.babelrc` file is detected ```js // Allowed without any warning Encore.configureBabel(null, { includeNodeModules: ['foo'] }); // Displays a warning and the // callback is ignored Encore.configureBabel( () => { /* ... */ } ); // Displays a warning and the // useBuiltIns option is ignored. Encore.configureBabel(null, { useBuiltIns: 'foo', includeNodeModules: ['foo'], }); ``` Commits ------- a9af955 Merge branch 'master' into configure-babel-optional-callback ffe3054 Recommend null instead of false for the first parameter of configureBabel() 644d1ac Allow to call configureBabel with an external Babel configuration
configureBabel
currently has 2 arguments:As the callback is incompatible with the usage of an external Babel config, this method throws an error when using it that way. But that means there is no way to configure options in such case.
The text was updated successfully, but these errors were encountered: