為什么沒有引入編譯后的js文件???
為什么沒有引入編譯后的js文件???
var htmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
? main:'./src/script/main.js',
? a: './src/script/a.js'
}, //打包入口
output: { ? ? ? ? ? ? ? ? ? ? ? ? //打包好存放的路徑和文件名
? path: './dist',
? filename: 'js/[name]-[chunkhash].js ',
},
plugins: [
? new htmlWebpackPlugin({
? ? hash: true,
? ? template: 'index.html',
? ? inject: 'head',
? ?xhtml: true,
})
]
}
只是把index.html的模板編譯到了dist目錄下,生成的index.html并沒有引入js
2019-02-24
已解決!output的filename賦值路徑結尾多了個空格導致的,希望大家注意。