webpack <%=%>與excludeChunks能不能同時使用?
html.js
<!DOCTYPE?html> <html> <head> <meta?charset="UTF-8"> <title>Document</title> </head> <body> <scritp><%=?compilation.assets[htmlWebpackPlugin.files.chunks.main.entry.substr(htmlWebpackPlugin.files.publicPath.length)].source()?%></scritp> </body> </html>
webpack.config.js
var?htmlWebpackPlugin?=?require('html-webpack-plugin');
module.exports?=?{
????//?入口文件
????entry:?{
????????a:?'./a.js',
????????main:?'./main.js'
????},
????//?出口文件
????output:?{
????????filename:?'js/[name].js',
????????path:?'./dist'
????},
????//?插件安裝
????plugins:?[
????????new?htmlWebpackPlugin({
????????????filename:?'a.html',
????????????template:?'./index.html',
????????????inject:?'body',
????????????excludeChunks:?['main']
????????})
????]
};問題:
<scritp><%= compilation.assets[htmlWebpackPlugin.files.chunks.main.entry.substr(htmlWebpackPlugin.files.publicPath.length)].source() %></scritp>的方式加載的腳本能不能excludeChunks
掉?
2017-05-12
接口里用main.entry寫的方法,在webpack.config文件中的excludeChunks里就不能把‘main’排除掉
2017-03-04
可以的
2017-02-23
have a try