Home > other >  webpack dev server doesn't run piz help me
webpack dev server doesn't run piz help me

Time:10-30

my webpack dev sercer doesn't run piz help my

my err :

enter image description here

webpack config

devtool: 'inline-source-map',
    devServer: {
        contentBase:  path.resolve(__dirname, './dist/app.js'),
        compress: true,
        port: 3000,
        open: true,
        hot: true,
        watchContentBase: true
    }

package.json :

"scripts": {
    "build": "webpack",
    "dev": "webpack serve"
  },


"devDependencies": {
    "alpinejs": "^3.4.2",
    "css-loader": "^6.5.0",
    "html-webpack-plugin": "^5.5.0",
    "style-loader": "^3.3.1",
    "webpack": "^5.60.0",
    "webpack-cli": "^4.9.1",
    "webpack-dev-server": "^4.4.0"
  }

CodePudding user response:

comment watchContentBase and try again

CodePudding user response:

This config is no longer supported in webpack version 5

try this

{
    devtool: 'inline-source-map',
    devServer: {
        static:  {
            directory: path.resolve(__dirname, './dist/app.js')
        },
        compress: true,
        port: 3000,
        open: true,
        hot: true,
        watch: true
    }
}

for more details you can look at dev-server documentation

  • Related