I am trying to apply babel-loader to a specific module template like foo. * , under node_modules in addition to my application.
Other modules under node_modules should be skipped as usual. At first I tried to use a negative look, but did not work:
{ test: /\.js$/, exclude: [ /node_modules\/(?!foo).*/ ], loader: 'babel-loader', query: { ... } },
Then I split into two bootloaders and didn't work:
{ test: /\.js$/, exclude: [ path.resolve(_path, "node_modules") ], loader: 'babel-loader', query: { ... } }, { test: /\.js$/, include: [ /node_modules\/foo.*/ ], loader: 'babel-loader', query: { ... } }
However, if I use a string instead of RegEx, it works for a single folder:
include: [ path.resolve(_path, "node_modules/foo") ],
This indicates that Regex is not working as expected.
Has anyone got a RegEx working in an Include/Exclude field?
source share