0.1.0 • Published 5 years ago

html-inject-common-chunk-plugin v0.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

html-inject-common-chunk-plugin

A webpack Plugin. It must be used after 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()
    ]
};