Specify output directory with dynamic import
See original GitHub issueDo you want to request a feature or report a bug?
Neither
What is the current behavior?
I am wondering if it is possible to specify an output directory per dynamic import context:
import(/* webpackChunkName: "svg-" */ `resources/assets/images/svg/${this.name}.svg`)
.then((module) => {
this.svg = module;
}
).catch(error => 'An error occured while loading the svg');
When using something like the above I would like to specify the output directory of these files so they end up in: public/js/svg/
.
I am currently doing it by using this:
output: {
publicPath: '/',
chunkFilename: 'js/svg/[name].js'
},
This is obviously not flexible since it will do this for all dynamic imports so I can’t re-use it for anything but SVG’s.
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
In my case,
[request]
is always interpreted literally assomefilename.[request].js
. Anyone with the same problem?Well technically you could do
/* webpackChunkName: "/js/svg/svg-[name]" *
but that could lead to other problems i think.