Saturday, November 11, 2017

Does Webpack 1 support 'include' and 'exclude' within loaders?

Leave a Comment

Does Webpack 1.* support the include and exclude options within a loader? I can not find documentation saying it does, nor does the Webpack-1 github branch have any examples containing it.

{   // ....   module: {     loaders: [       {          test: '\.js',          include: [/node_modules/],          exclude: [/extra_srcs/]       }     ]   } } 

1 Answers

Answers 1

Yes. As noted in those docs, include is preferable over exclude, when possible. Those docs also suggest that exclude should be a condition, so an array may not work there. Using your example:

{   // ....   module: {     loaders: [       {         test: /\.js$/,         include: [/node_modules/],         exclude: /extra_srcs/       }     ]   } } 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment