Does webpack-html-plugin not automatically reference common code extracted by splitChunks?

first paste the project structure.

webpack.base.config.js

//
const SRC_PATH = path.resolve(__dirname, "../src");
const OUTPUT_PATH = path.resolve(__dirname, "../dist");
const PUBLIC_PATH = "/dist/";

// html-webpack-plugin
const getHtmlConfig = function(name){


};

const config = {


}

webpack.prod.config.js

const config = merge(baseConfig,{


})

indexaboutuserlodash

at this time, because splitChunks extracts the common module as vendor, but opens the three html files (index,about,user) generated by the last package, it is found that only the corresponding chunks: [name,"common"] is introduced, while vendor is not automatically introduced. I don"t think vendor should be written into the chunks item of webpackHtmlPlugin here, because suppose I index introduced a module. My user also introduced a module, but I may forget or do not know that the two modules are the same, but the splitChunks extracted, I can not all the webpackHtmlPlugin chunks items are introduced, that is meaningless ah, excuse me, is there a way to automatically introduce the public module extracted by splitChunks? Thank you

Aug.10,2021

every cache block in cacheGroups is actually a chunk,. If you want to automatically introduce it in html, add the corresponding key value of cacheGroups to the chunk array in htmlWebpackPlugin. Just add 'commons'' to the chunk array below. Pay attention to the following s

return {
    template    : './views/' + name + '.html',
    filename    : name + '.html',
    title       : name,
    inject      : true,
    hash        : true,
    chunks      : [name,'common','commons']
};
  • Express+webpack+ejs running error report

    my directory package.json : webpack.config.js: app.js : index.ejs : npm run server : title error in index.ejs is not defined. For the first time, express and webpack, have searched for related problems on this site, but failed to find a solutio...

    May.22,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37a55-2c0b9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37a55-2c0b9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?