課程
/前端開發
/前端工具
/webpack深入與實戰
為什么在webpack.config.js里plugin的里面,chunks這個會報錯
2017-02-21
源自:webpack深入與實戰 3-3
正在回答
代碼: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'??? },//打包的入口 /*['./src/script/main.js','./src/script/a.js'],*/??? output: {??????? path: './dist',// 路徑??????? filename: 'js/[name]-[chunkhash].js',//打包以后的文件名??? [name]-[chunkhash] [name]-[hash]??????? publicPath: 'https:abc.com'??? },??? plugins:[??????? new htmlWebpackPlugin({??????????? filename: 'a.html',??????????? template: 'index.html',??????????? inject: 'body',??????????? title: 'this is a.html',??????????? chunks: ['a','main']??????? }),??????? new htmlWebpackPlugin({??????????? filename: 'b.html',??????????? template: 'index.html',??????????? inject: 'body',??????????? title: 'this is b.html',??????????? chunks: ['b']??????? }),??????? new htmlWebpackPlugin({??????????? filename: 'c.html',??????????? template: 'index.html',??????????? inject: 'body',??????????? title: 'this is c.html',??????????? chunks: ['c']??????? })??? ]}
錯誤:
晚安里久違的夢鄉
什么錯誤啊。。
舉報
webpack實戰教程,用真實項目帶你探索 webpack 強大的功能
3 回答這里為什么會報錯!
1 回答老師,在webpack.config.js里面一配置minify就報下邊這樣的錯,怎么解決呢?
13 回答chunks報錯
1 回答htmlWebpackPlugin.files里不存在chunks字段
4 回答webpack.config.js報錯
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-02-24
代碼: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'
??? },//打包的入口 /*['./src/script/main.js','./src/script/a.js'],*/
??? output: {
??????? path: './dist',// 路徑
??????? filename: 'js/[name]-[chunkhash].js',//打包以后的文件名??? [name]-[chunkhash] [name]-[hash]
??????? publicPath: 'https:abc.com'
??? },
??? plugins:[
??????? new htmlWebpackPlugin({
??????????? filename: 'a.html',
??????????? template: 'index.html',
??????????? inject: 'body',
??????????? title: 'this is a.html',
??????????? chunks: ['a','main']
??????? }),
??????? new htmlWebpackPlugin({
??????????? filename: 'b.html',
??????????? template: 'index.html',
??????????? inject: 'body',
??????????? title: 'this is b.html',
??????????? chunks: ['b']
??????? }),
??????? new htmlWebpackPlugin({
??????????? filename: 'c.html',
??????????? template: 'index.html',
??????????? inject: 'body',
??????????? title: 'this is c.html',
??????????? chunks: ['c']
??????? })
??? ]
}
錯誤:
2017-02-21
什么錯誤啊。。