Cannot read property 'entry' of undefined
var htmlWebpackPlugin = require('html-webpack-plugin');
//commom.js的模块化输出
module.exports={
entry:{
main:'./src/script/main.js',
a: './src/script/a.js',
b: './src/script/b.js',
c: './src/script/c.js'
},//入口文件
output:{
path:'./dist',
filename:'js/[name]-[chunkhash].js',
// publicPath:"http://cdn.com/"
},
plugins:[
new htmlWebpackPlugin({
filename:'a.html',
template:'index.html',
title:"webapck is a",
inject:'body',
chunks:['main','a']
}),
new htmlWebpackPlugin({
filename:'b.html',
template:'index.html',
title:"webapck is b",
inject:'body',
chunks:['b']
}),
new htmlWebpackPlugin({
filename:'c.html',
template:'index.html',
title:"webapck is c",
inject:'body',
chunks:['c']
})
]
};除了a页面可以生成,b.html和c.html都有错误
Html Webpack Plugin: <pre> TypeError: Cannot read property 'entry' of undefined - index.html:17237 D:/dwf/study/webpacklearn/index.html:17237:42 - index.html:17240 module.exports D:/dwf/study/webpacklearn/index.html:17240:3 - index.js:265 [webpacklearn]/[html-webpack-plugin]/index.js:265:16 - util.js:16 tryCatcher [webpacklearn]/[bluebird]/js/release/util.js:16:23 - promise.js:512 Promise._settlePromiseFromHandler [webpacklearn]/[bluebird]/js/release/promise.js:512:31 - promise.js:569 Promise._settlePromise [webpacklearn]/[bluebird]/js/release/promise.js:569:18 - promise.js:606 Promise._settlePromiseCtx [webpacklearn]/[bluebird]/js/release/promise.js:606:10 - async.js:138 Async._drainQueue [webpacklearn]/[bluebird]/js/release/async.js:138:12 - async.js:143 Async._drainQueues [webpacklearn]/[bluebird]/js/release/async.js:143:10 - async.js:17 Immediate.Async.drainQueues [webpacklearn]/[bluebird]/js/release/async.js:17:14 </pre>