在用webpack的时候,想要使用html-webpack-plugin来注入favicon,但是输出路径是output.path的,不知道怎么改代码constwebpack=require('webpack');constpath=require('path');consthtmlWebpackPlugin=require('html-webpack-plugin');constcleanWebpackPlugin=require('clean-webpack-plugin');module.exports={entry:'app/scripts/main.js',output:{filename:'bundle.js',path:'dist/scripts'},module:{rules:[{test:/\.js$/,exclude:/(node_modules|bower_components)/,use:{loader:'babel-loader',options:{presets:['react','es2015']}}}]},plugins:[newwebpack.optimize.UglifyJsPlugin(),newhtmlWebpackPlugin({favicon:'app/favicon.ico',filename:"dist/index.html",template:'app/index.html'}),newcleanWebpackPlugin(['dist'])]}
2 回答
ABOUTYOU
TA贡献1812条经验 获得超5个赞
陷入逻辑陷阱了,只想改html-webpack-plugin中的配置,其实可以把output改一下output:{path:'dist',filename:'scripts/bundle.js'}
添加回答
举报
0/150
提交
取消