Cannot read property 'entry' of undefined
const?path=require("path"); var?htmlWebpackPlugin=require("html-webpack-plugin"); module.exports?=?{ //?configuration //?entry:'./src/script/main.js',?//?單個(gè)string //?entry:['./src/script/main.js','./src/script/a.js'],?//?數(shù)組,多個(gè)string entry:{ mian:'./src/script/main.js', a:'./src/script/a.js', b:'./src/script/b.js', c:'./src/script/c.js' }, output:{ path:path.join(__dirname,"dist"),?//?打包目錄 filename:'js/[name]-[chunkhash].bundle.js',?//?js打包后的文件 publicPath:'http://www.iVue.com/'?//?占位符?線上地址 }, plugins:[ new?htmlWebpackPlugin({?//?調(diào)用一次插件生成單頁面 template:'index.html', filename:'a-[hash].html',??//?index.[hash].html inject:'head',//?false title:'a?webpack?is?awesome', date:new?Date(), minify:{????//?壓縮html文件 removeComments:true,?//?刪除html注釋 collapseInlineTagWhiteSpace:true?//?刪除空格 } }), new?htmlWebpackPlugin({?//?調(diào)用多次生成多頁面 template:'index.html', filename:'b-[hash].html',??//?index.[hash].html inject:'head',//?false title:'b?webpack?is?awesome', date:new?Date(), minify:{????//?壓縮html文件 removeComments:true,?//?刪除html注釋 collapseInlineTagWhiteSpace:true?//?刪除空格 } }), new?htmlWebpackPlugin({?//?調(diào)用多次生成多頁面 template:'index.html', filename:'c-[hash].html',??//?index.[hash].html inject:'head',//?false title:'c?webpack?is?awesome', date:new?Date(), minify:{????//?壓縮html文件 removeComments:true,?//?刪除html注釋 collapseInlineTagWhiteSpace:true?//?刪除空格 } }) ] };
<head> <title><%=?htmlWebpackPlugin.options.title%></title> <!--綁定title--> <meta?charset="UTF-8"> <meta?name="viewport"?content="width=device-width,?initial-scale=1"> <script?src="<%=?htmlWebpackPlugin.files.chunks.main.entry%>"></script> </head>
我在打包的時(shí)候,一直報(bào)錯(cuò)的語句
<%= htmlWebpackPlugin.files.chunks.main.entry%>
錯(cuò)誤提示:
?ERROR?in?Template?execution?failed:?TypeError:?Cannot?read?property?'entry'?of?undefined ERROR?in???TypeError:?Cannot?read?property?'entry'?of?undefined ??-?index.html:17172 ????E:/Test/webpack/webpack-framework/index.html:17172:46
2017-05-14
看一下你的第8行。。。。mian、main~曾經(jīng)多次敲錯(cuò)的英文單詞啊
2017-06-29
我也是這個(gè)問題 請(qǐng)問解決了嗎 我看了一下我沒有寫錯(cuò)的地方啊