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

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

chunks報錯

我除了a頁面,其他的用chunks或者excludeChunks 都不行,是我用的假插件嗎

正在回答

12 回答

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'],
? ? ? ?}),
? ?]
}

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

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


0 回復 有任何疑惑可以回復我~
首頁上一頁12下一頁尾頁

舉報

0/150
提交
取消

chunks報錯

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

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

幫助反饋 APP下載

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

公眾號

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