Reputation: 2418
I am currently using the WebpackHtmlPlugin to simplify my index.html entrypoint however my main issue is that the index.html gets placed on the same level as all other assets (namely wherever publicPath points to).
I'd like to have the index.html served in a folder and all assets generated by webpack in a subfolder. Something like this
index.html
build/
bundle.js
1.bundle.js
2.bundle.js
Is there any way one can achieve this without going against webpack and manually map each asset by hand and set publicPath to be root?
Upvotes: 2
Views: 946
Reputation: 6402
You can use the CopyWebpackPlugin altogether with HTMLWebpackPlugin...
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: "index.html",
inject: false
}),
new CopyWebpackPlugin([
{ from: 'from/directory/**/*', to: '/absolute/path' },
])
],
see the reference in https://www.npmjs.com/package/copy-webpack-plugin
Upvotes: 1