-
-
Notifications
You must be signed in to change notification settings - Fork 200
Allow to configure the JS exclude rules through configureBabel #401
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
Conversation
cf28209 to
71793c0
Compare
11c911e to
f05d4d2
Compare
f05d4d2 to
714a732
Compare
index.js
Outdated
| * // change the babelConfig | ||
| * }, { | ||
| * // set optional Encore-specific options | ||
| * // exclude: /(node_modules|bower_components)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small detail: but could we add include_node_modules here too with a decent example? It's documented below, but at first glance, I thought this was the only option :)
|
|
||
| if (!Array.isArray(options[optionKey])) { | ||
| throw new Error('Option "include_node_modules" passed to configureBabel() must be an Array.'); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great error checking and messages as usual!
5deed94 to
a07238c
Compare
|
Thank you @Lyrkan! Great work as usual! |
…eBabel (Lyrkan) This PR was squashed before being merged into the master branch (closes #401). Discussion ---------- Allow to configure the JS exclude rules through configureBabel This PR closes #342 by allowing to configure the js/jsx loaders' exclude rule by using `configureBabel()`. For instance: ```js Encore.configureBabel( () => {}, { exclude: /foo/ } ); ``` Note that it doesn't change the default behavior that excludes `node_modules` and `bower_components`. **Edit:** Also adds an `include_node_modules` option to use the default `exclude` rule but only include some Node modules (can't be used if the `exclude` option is also set): ```js Encore.configureBabel( () => {}, { include_node_modules: ['foo', 'bar', 'baz'] } ); ``` Commits ------- a07238c Add an example of calling configureBabel with the "include_node_modules" option 714a732 Add "include_node_modules" option to configureBabel 6c8f073 Allow to configure the JS exclude rules through configureBabel
This PR closes #342 by allowing to configure the js/jsx loaders' exclude rule by using
configureBabel().For instance:
Note that it doesn't change the default behavior that excludes
node_modulesandbower_components.Edit:
Also adds an
include_node_modulesoption to use the defaultexcluderule but only include some Node modules (can't be used if theexcludeoption is also set):