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

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

webpack關于通過html-webpack-plugin插件使用同一個模版template生成多個文件

plugins:[

????new htmlWebpackPlugin({

????????????template:'index.html',

????????????filename:'index.a.html',

????????????inject:false,

????????????title:'webpack title a',

????????????body:'a body',

????????????excludeChunks:['b','c']

????????????minify:{

????????????removeComments:true, ?//去除注釋

????????????collapseWhitespace:true ?//去除空格

????}

})

用一個模版生成一個index.a.html文件,沒問題,但是用同一個模版生成index.a.html,index.b.html,index.c.html就會報錯,視頻里老師也沒錯啊,而且報錯有點莫名其妙,有和我一樣的么?

用兩個不同的模版生成兩個文件也沒問題

????plugins:[

????????new htmlWebpackPlugin({

????????template:'index.html',

????????filename:'index.a.html',

????????inject:false,

? ? ????title:'webpack title a',

????????body:'a body',

????????excludeChunks:['b','c']

????????minify:{

????????????removeComments:true, ?//去除注釋

????????????collapseWhitespace:true ?//去除空格

????????}

????}),

????new htmlWebpackPlugin({

????????template:'index.html',

????????filename:'index.b.html',

????????inject:false,

????????title:'webpack title b',

????????body:'b body',

????????chunks:['main','b']

????}),

????new htmlWebpackPlugin({

????????template:'index.html',

????????filename:'index.c.html',

????????inject:false,

????????title:'webpack title c',

????????body:'c body',

????????chunks:['main','c']

????})

]

http://img1.sycdn.imooc.com//5972ede900010c3e07930436.jpg

正在回答

1 回答

模板文件的script引用刪除了么? 注釋掉是不行的,必須要刪除

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

舉報

0/150
提交
取消

webpack關于通過html-webpack-plugin插件使用同一個模版template生成多個文件

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

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

幫助反饋 APP下載

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

公眾號

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