A question about webpack configure settings: in most examples, the test option in loader only checks the file name, not the full path. I have files in different directories that are the same type, but I want to use a different loader, e.g.
{ test:/aaa\/.*.html/, loader:'loaderA' }, { test:/bbb\/.*.html/, loader:'loaderB' }
Is there any way to make that work? Thanks for your attention and answers.
publicPath specifies the virtual directory in web server from where bundled file, app. js is going to get served up from. Keep in mind, the word server when using publicPath can be either webpack-dev-server or express server or other server that you can use with webpack.
Webpack goes through all the import ed and require d files in your project, and for all those files which have a . svg extension, it uses as an input to the webpack file loader. For each of these files, the file loader emits the file in the output directory and resolves the correct URL to be referenced.
You can use include
and exclude
properties (docs):
{ test:/\.html$/, include: [ path.resolve(__dirname, "app/pathA") ], loader: 'loaderA' }, { test:/\.html$/, include: [ path.resolve(__dirname, "app/pathB") ], loader: 'loaderB' }
For files in folder pathA
will applied loader loaderA
, and for pathB
- loader loaderB
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With