As @sokra suggested in one of webpack 4 posts to preserve long term caching:
or switch off name generation via optimization.splitChunks.name: false
html-webpack-plugin somehow fails to inject the generated "splitted" files when I apply this option in combination with output: { filename: '[name].[chunkhash].js' }.
module.exports = {
mode: 'production',
output: {
filename: '[name].[chunkhash].js',
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.ejs',
favicon: './src/favicon.ico',
}),
],
optimization: {
splitChunks: {
chunks: 'all',
name: false,
},
runtimeChunk: true,
},
};
Template file:
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
Node.js v8.9.0
darwin 15.6.0
npm 5.5.1
webpack 4.0.1
html-webpack-plugin 3.0.4
+1
+1. The same stuff. With
splitChunks: {
chunks: 'all',
name: false,
},
html-wepback-plugin doesn't inject chunks that are not specified as entry points.
Any solution?
This happens for us with names on as well, dependent chunks are not included.
any update on this issue? is there a walk around or plan to fix ?
I met this problem too.
+1
+1
+1
Could you please try if this works for you with 4.x alpha?
npm i html-webpack-plugin@next
@jantimon Works like a charm. :trumpet::kissing::tada: Thanks!
Most helpful comment
+1. The same stuff. With
splitChunks: { chunks: 'all', name: false, },html-wepback-plugin doesn't inject chunks that are not specified as entry points.