chunks报错
我除了a页面,其他的用chunks或者excludeChunks 都不行,是我用的假插件吗
我除了a页面,其他的用chunks或者excludeChunks 都不行,是我用的假插件吗
2017-03-09
var htmlWebpackPlugin = require('html-webpack-plugin');//初始化插件
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',//生成的文件名称
// filename : 'index-[hash].html',
template : 'index.html',//模板文件
inject : 'body', // inject : 'body',//script标签放置位置
title : '模板传值a',
// minify : {//压缩
// removeComments : true,//删除注释
// collapseInlineTagWhitespace : true,//删除空格
// },
excludeChunks :['b','c'],
}),
new htmlWebpackPlugin({
filename : 'b.html',//生成的文件名称
// filename : 'index-[hash].html',
template : 'index.html',//模板文件
inject : false, // inject : 'body',//script标签放置位置
title : '模板传值b!',
excludeChunks :['b','c'],
}),
new htmlWebpackPlugin({
filename : 'c.html',//生成的文件名称
// filename : 'index-[hash].html',
template : 'index.html',//模板文件
inject : false, // inject : 'body',//script标签放置位置
title : '模板传值c!',
excludeChunks :['b','c'],
}),
]
}
ERROR in Template execution failed: TypeError: Cannot read property 'entry' of undefined
ERROR in TypeError: Cannot read property 'entry' of undefined
- index.html:17226
E:/demo2/index.html:17226:43
- index.html:17231 module.exports
E:/demo2/index.html:17231:3
- index.js:265
[demo2]/[html-webpack-plugin]/index.js:265:16
- util.js:16 tryCatcher
[demo2]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[demo2]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[demo2]/[bluebird]/js/release/promise.js:569:18
- promise.js:606 Promise._settlePromiseCtx
[demo2]/[bluebird]/js/release/promise.js:606:10
- async.js:138 Async._drainQueue
[demo2]/[bluebird]/js/release/async.js:138:12
- async.js:143 Async._drainQueues
[demo2]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues
[demo2]/[bluebird]/js/release/async.js:17:14
ERROR in Template execution failed: TypeError: Cannot read property 'entry' of undefined
ERROR in TypeError: Cannot read property 'entry' of undefined
- index.html:17226
E:/demo2/index.html:17226:43
- index.html:17231 module.exports
E:/demo2/index.html:17231:3
- index.js:265
[demo2]/[html-webpack-plugin]/index.js:265:16
- util.js:16 tryCatcher
[demo2]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[demo2]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[demo2]/[bluebird]/js/release/promise.js:569:18
- promise.js:606 Promise._settlePromiseCtx
[demo2]/[bluebird]/js/release/promise.js:606:10
- async.js:138 Async._drainQueue
[demo2]/[bluebird]/js/release/async.js:138:12
- async.js:143 Async._drainQueues
[demo2]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues
[demo2]/[bluebird]/js/release/async.js:17:14
举报