htmlWebpackPlugin多页面配置 templateParameters报错Cannot read property 'title' of undefined
xcgs123 opened this issue · comments
// 多页面配置
配置了templateParameters,报错Cannot read property 'title' of undefined,有遇到过同样问题的吗
let publicPath = process.env.PUBLIC_PATH;
glob.sync('./src/**/main.js').forEach(entry => {
let publicPath = process.env.PUBLIC_PATH;
let chunk = entry.match(/\.\/src\/(.*)\/main\.js/)[1];
const curr = pagesInfo[chunk];
if (curr) {
pages[chunk] = {
entry,
...curr,
templateParameters: (compilation, assets, assetTags, options) => {// 配置了对象,报错html-webpack-plugin is not defined
return {
compilation,
webpackConfig: compilation.options,
htmlWebpackPlugin: {
tags: assetTags,
files: assets,
options
},
publicPath
};
}
};
}
});
home: {
entry: 'src/home/main.js',
template: 'entry/index.html',
filename: 'home/index.html',
title: '平台'
},