project, I first cooperate with NPM to execute the webpack command to build the code, in which clean-webpack-plugin is used to delete the previous build results before generating a new one.
After, I use the webpack-dev-server-- open command with NPM to start the server, but at this time, clean-webpack-plugin will also be executed, and then the build directory generated when I first executed the webpack command will be deleted. What should I do?
< H2 > Code < / H2 >package.json
"scripts": {
"start": "webpack-dev-server --open",
"build": "webpack",
},
webpack.config.js
plugins: [
//
new CleanWebpackPlugin([path.join(__dirname, "build")]),
],
devServer: {
contentBase: "./build",
},