Support multiple Webpack entries #299
Comments
sorry this wouldn't work for all the users who are already using the plugin - please add a loop to your configuration file |
@jantimon whats the loop for? I think it can be done by defining n number of HtmlWebpackPlugin instances and excluding the chunks from other entries like:
|
@iwano Yes exactly - but if you have a lot of those you could also use a loop to keep them connected:
|
@jantimon oh nice, thanks! |
@jantimon seems that we still are missing the important part for instance, multiple entries have some non-async common chunks, we have to configure like this var entry: {
a : ['./a', 'common-a-b'],
b : ['./b', 'common-a-b'],
}; It is difficult to maintain such dependencies manually. Is there any options like this? new HtmlWebpackPlugin({
filename: entryName + '.html',
chunks: [entryName],
includeParentChunks: true
}) so we needn't to apply non-entry chunks manually. |
@lwr this requires a complex parent resolution which would be very specific for your problem - could we find a way to isolate it into a new npm package? |
@jantimon thx Maybe "only use async common chunks" would be the better option. I have tried config webpack 4 like this (a,b have no any common with c,d) splitChunks : {
cacheGroups : {
'common-a-b' : { name : 'common-a-b', chunks : 'initial', test : /^(a|b)$/ },
'common-c-d' : { name : 'common-c-d', chunks : 'initial', test : /^(c|d)$/ },
}
} and found that this is not worked a.html
<script src='common-a-b.js'></script>
<script src='a.js'></script> because a.js is still requiring chunk common-b-c (only because it is marked 'initial') before it start |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Working in a project with multiple entries which are placed in multiple folders:
It would be neat to be able to generate multiple .html files, utilising the [name] substitution to support multiple names. What say you?
Like:
The text was updated successfully, but these errors were encountered: