1.0.1 • Published 4 years ago
html-webpack-inline-runtime-chunk-plugin v1.0.1
html-webpack-inline-runtime-chunk-plugin
Inline Webpack's runtime chunks within the output html to save http request(only support webpack 5). It requires html-webpack-plugin.
Installation
npm install html-webpack-inline-runtime-chunk-plugin --save-dev
Usage
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackInlineRuntimeChunkPlugin = require('html-webpack-inline-runtime-chunk-plugin');
module.exports = {
output: {
// the default value of output.publicPath is "auto"
// but it can\'t not automatically determine after inline runtime chunk within html
// you can set publicPath to '' to get similar results
publicPath: '',
filename: '[name].[contenthash].js',
},
optimization: {
// adds an additional chunk containing only the runtime to entrypoint
runtimeChunk: 'single'
},
plugins: [
new HtmlPlugin(),
new HtmlWebpackInlineRuntimeChunkPlugin()
],
}