亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

本節最后的問題

http://img1.sycdn.imooc.com//58abe5b20001b24d05180567.jpg

ERROR in Template execution failed: TypeError: Cannot read property 'entry' of undefined


ERROR in ? TypeError: Cannot read property 'entry' of undefined


<%= compilation.assets[htmlWebpackPlugin.files.chunks.main.entry.substr(htmlWebpackPlugin.files.publicPath.length)].source() %> ?取不到entry嗎? 為什么?這里有點懵

正在回答

3 回答

你的plugins里chunks少了main

2 回復 有任何疑惑可以回復我~
#1

_莫忘初衷_ 提問者

3Q
2017-02-21 回復 有任何疑惑可以回復我~

// 解決了hash問題,以及生成html文件,壓縮html,自動引入帶hash的js文件。

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',

// 此key上線時需要,為絕對路徑。

publicPath:'http://www.yangshaofeng.cn/'

},

plugins: [

new htmlWebpackPlugin({

filename:'a.html',

template:'index.html',

title:'this is a.html',

inject:'body',

minify:{

removeComments:true,

collapseWhitespace:true

},

excludeChunks:['b','c']

}),

new htmlWebpackPlugin({

filename:'b.html',

template:'index.html',

title:'this is b.html',

inject:'body',

minify:{

removeComments:true,

collapseWhitespace:true

},

excludeChunks:['main','a','c']

}),

new htmlWebpackPlugin({

filename:'c.html',

template:'index.html',

title:'this is c.html',

inject:'body',

minify:{

removeComments:true,

collapseWhitespace:true

},

excludeChunks:['main','a','b']

})

]

}

求助

0 回復 有任何疑惑可以回復我~

更新下node


0 回復 有任何疑惑可以回復我~
#1

_莫忘初衷_ 提問者

我的已經是最新版本node v6.2.0
2017-02-21 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

本節最后的問題

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號