-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Description
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' }
.
Config
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>
Relevant Links
Environment
Node.js v8.9.0
darwin 15.6.0
npm 5.5.1
webpack 4.0.1
html-webpack-plugin 3.0.4
mathewhany, yanceyou, lanoxx, lwyj123, yenshih and 1 morelanoxxlanoxx
Metadata
Metadata
Assignees
Labels
No labels