var path = require("path");
var CleanWebpackPlugin = require('clean-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack'); // 引入 webpack 便于调用其内置插件
// console.log(CleanWebpackPlugin);
module.exports = {
devtool: 'inline-source-map',
devServer: {
contentBase: path.resolve(__dirname, 'dist/js'),
hot: true, // 告诉 dev-server 我们在用 HMR
hotOnly: true, // 指定如果热加载失败了禁止刷新页面 (这是 webpack 的默认行为),这样便于我们知道失败是因为何种错误
inline:true,
},
entry: {
print:'./src/js/print.js',
index:'./src/js/index.js'
},
module:{
rules:[
{
test:/\.css$/,
use:['style-loader','css-loader']
},
]
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
title: 'Output Management',
inject:'head',
filename:'index.html',
template:'index.html'
}),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin()
],
output: {
path: path.resolve(__dirname,'./dist'),
filename: '[name].bundle.js',
// chunkFilename:'[name].bundle.js',
},
};
每次都会生成这些文件 如何配置不生成呢
宝慕林4294392
相关分类