You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
It would be great if this could be setup as an option, along the lines of options.jsConfigExclude with a default value of [/[/\\\\]node_modules[/\\\\]/] that could be passed in as
for those of us who want to intentionally include the node_modules folder to be transpiled by babel.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Using https://www.npmjs.com/package/signature_pad in some of my projects with the common config ends up with class in my bundles, and IE 11 does not know what to do with this, which causes all kinds of problems (the rest of the code in the bundle stops functioning). When including my own override for this by doing:
module: {rules: [{test: /\.(js|jsx|mjs)$/,//exclude: [/[/\\\\]node_modules[/\\\\]/], // exclude node_modules folder per defaultuse: [// run process in multiple threadsrequire.resolve("thread-loader"),{loader: require.resolve("babel-loader"),options: {extends: "./.babelrc.json",// cache builds, future builds attempt to read from cache to avoid needing to run expensive babel processingscacheDirectory: true,// do not include superfluous whitespace characters and line terminators// https://babeljs.io/docs/en/babel-core/#optionscompact: true,},},],},],},
everything is transpiled through babel and works as expected. On my system (which is 6+ years old, dell optiplex 3010, core i3) I did not notice any significant difference in runtime for building bundles. Others may have different experience with that (noting that excluding node_modules is recommended to decrease runtime), which is why I'm hoping this can be an option and the default can maintain the current value so it would not be a breaking change.
On further investigation it actually looks like excluding node_modules is really not meant to be done when target is set to web (default). If target is set to something else (like node) then it may be desirable to exclude node_modules. Excluding node_modules seems like it would be better accomplished with webpack-node-externals and maybe not included in this project since the end user could add this themselves as needed. Further reference liady/webpack-node-externals#17 (comment)
However - when running in a web environment - all the dependencies must be bundled as well (there are no sync require calls in the browser) - so using this library will actually not make sense.
I would propose that since target is not set by default anywhere in this plugin (it would default to web) that node_modules should not be excluded at all, and users who set a target to an environment that should exclude node_modules should be handling the exclusion on their own, either by defining exclude or by using a plugin like webpack-node-externals
I'm submitting a...
Current behavior
https://github.com/namics/webpack-config-plugins/blob/6bf7421bf492dba2d1b62e1889c3970c2f48b4bf/packages/js-config-webpack-plugin/config/production.config.js#L13 and https://github.com/namics/webpack-config-plugins/blob/6bf7421bf492dba2d1b62e1889c3970c2f48b4bf/packages/js-config-webpack-plugin/config/development.config.js#L12 cause the
node_modules
folder NOT to be processed by the babel loader, and thus code from node packages is not transpiled per my babel configuration.Expected behavior
It would be great if this could be setup as an option, along the lines of
options.jsConfigExclude
with a default value of[/[/\\\\]node_modules[/\\\\]/]
that could be passed in asor
for those of us who want to intentionally include the
node_modules
folder to be transpiled by babel.Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Using https://www.npmjs.com/package/signature_pad in some of my projects with the common config ends up with
class
in my bundles, and IE 11 does not know what to do with this, which causes all kinds of problems (the rest of the code in the bundle stops functioning). When including my own override for this by doing:everything is transpiled through babel and works as expected. On my system (which is 6+ years old, dell optiplex 3010, core i3) I did not notice any significant difference in runtime for building bundles. Others may have different experience with that (noting that excluding
node_modules
is recommended to decrease runtime), which is why I'm hoping this can be an option and the default can maintain the current value so it would not be a breaking change.Environment
The text was updated successfully, but these errors were encountered: