When I used webpack-dev-server Webpack4 doesn't create folder 'dist' with file main.js.
My package.json
{
"name": "webpack-project",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server --mode development --open",
"build": "webpack --mode production"
},
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"path": "^0.12.7",
"webpack": "^4.20.1",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.9"
},
"dependencies": {}
}
My webpack.config.js
const path = require('path');
module.export = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'main.js',
publicPath: 'dist/'
}
}
But if there is "dev": "webpack --mode production" in package.json file, folder 'dist' with main.js file create.
Why it doesn't work when I use webpack-dev-server?