Option chunks Html Webpack Plugin (ok)
https://kentrung256.blogspot.com/2021/06/html-webpack-plugin.html
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
homepage: ['./src/index.js', './src/slider.js'],
aboutpage: ['./src/about.js']
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new HtmlWebpackPlugin({
title: 'Trang chủ',
filename: 'index.html',
template: './src/index.html',
chunks: ['homepage']
}),
new HtmlWebpackPlugin({
title: 'Về chúng tôi',
filename: 'about.html',
template: './src/about-dev.html',
chunks: ['aboutpage']
})
]
}PreviousWebpack từ A đến Á: Html Webpack Plugin (ok)NextWebpack từ A đến Á: Clean Webpack Plugin (ok)
Last updated