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
掉?