error will be reported when using npm run dev
const path = require("path");
const merge = require("webpack-merge");
const common = require("./webpack.common.js");
// dev-server
let BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
module.exports = merge(common, {
output: { //
//filename: "[name].bundle.js", //
// filename: "[name].[chunkhash].js",
// __dirname
path: path.resolve(__dirname, "./public"), //
publicPath:"dist/", // publicPath
filename: "./dist/[name].bundle.js",
chunkFilename: "./dist/[name].bundle.js"
},
devtool: "source-map",
devServer: {
contentBase: [path.join(__dirname, "./public")], //
host: "127.0.0.1",
compress: true,
port: 6600,
open: false //
},
plugins:[
new BundleAnalyzerPlugin({
analyzerMode: "server", // static/disabled
analyzerHost: "127.0.0.1",
analyzerPort: 9900,
openAnalyzer: false
})
]
});