Answer the question
In order to leave comments, you need to log in
Does webpack include ALL css files for every html page?
I'm trying to switch to webpack, I created a config for a build of two pages, each with its own css style file with a unique name.
Problem: When building, both css files are connected to each html at once, despite the fact that in the js file of each page I import only one file.
Config:
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(PATH.source.pages, 'home/home.pug')
}),
new HtmlWebpackPlugin({
filename: 'pages/about.html',
template: path.resolve(PATH.source.pages, 'about/about.pug')
}),
new ExtractTextPlugin({
filename: "styles-[name].css",
ignoreOrder: true,
allChunks: true
}),
],
Answer the question
In order to leave comments, you need to log in
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(PATH.source.pages, 'home/home.pug'),
chunks: ['<тут имена необходимых чанков - например index>']
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question