webpack4.0构建一个不使用webpack-dev-server监控文件变化的配置
webpack4.0配置:
const path = require('path');
const webpack = require("webpack");
const htmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry:{
app:"./src/main.js"
},
output:{
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
watch:true,
watchOptions:{
ignored: /node_modules/
},
plugins: [
new htmlWebpackPlugin({
template:"./src/index.html",
filename:"index.html",
}),
],
};
github 地址: https://github.com/zshsats/blogFile/tree/master/watchDemo