/ / glob is a third-party module that webpack depends on during installation, and the module also allows you to use symbols such as . For example, lib/ .js is the file that gets all the js suffixes under the lib folder
var glob = require ("glob")
var HtmlWebpackPlugin = require (" html-webpack-plugin")
var PAGE_PATH = path.resolve (_ _ dirname,". / src/pages")
var merge = require ("webpack-merge")
/ / Multi-entry configuration
/ / read the js suffix file under all the corresponding folders under the pages folder through the glob module, and treat it as an entry
exports.entries = function () {
/ /.
var entryFiles = glob.sync(PAGE_PATH + "/*/*.js")
var map = {}
entryFiles.forEach((filePath) => {
var filename = filePath.substring(filePath.lastIndexOf("\/") + 1, filePath.lastIndexOf("."))
map[filename] = filePath
})
return map
}
/ / Multi-page output configuration
/ / is the same as the above multi-page entry configuration. Read the corresponding html suffix file under the pages folder and put it in the array
exports.htmlPlugin = function () {
let entryHtml = glob.sync(PAGE_PATH + "/*/*.html")
let arr = []
entryHtml.forEach((filePath) => {
let filename = filePath.substring(filePath.lastIndexOf("\/") + 1, filePath.lastIndexOf("."))
let conf = {
//
template: filePath,
//
filename: filename + ".html",
// jsjs
chunks: ["manifest", "vendor", filename],
inject: true
}
if (process.env.NODE_ENV === "production") {
conf = merge(conf, {
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
},
chunksSortMode: "dependency"
})
}
arr.push(new HtmlWebpackPlugin(conf))
})
return arr
}
according to the above code. This is what happens after packing
pages
how do I change the configuration inside?