html-inject-common-chunk-plugin
v0.1.0
Published
Insert public resources into the page
Downloads
3
Readme
html-inject-common-chunk-plugin
A webpack Plugin. It must be used after [html-webpack-plugin] (https://github.com/jantimon/html-webpack-plugin)
After using webpack4 splikChunk, the public chunk name is dynamically generated, so the html-webpack-plugin
cannot insert the corresponding chunk into the html template. This plugin is to solve this problem
Installation
npm install html-webpack-plugin --save-dev
npm install html-inject-common-chunk-plugin --save-dev
webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin');
const InjectCommonChunk = require('html-inject-common-chunk-plugin');
module.exports = {
...
plugins: [
new HtmlWebpackPlugin({
filename: '../htmlprod/index.html',
template: './htmltpl/index.html',
chunks: ['index']
}),
new InjectCommonChunk()
]
};