Accepted answer

I faced a similar issue too, what I was doing was I miss spelt a property in my webpack.config.js which is

module.exports = {
  entry: "./src/index.js",
  output: {
    path: path.resolve(__dirname, "dist/assets"),
    filename: "bundle.js",
  devServer: {
    contentBase: path.resolve(__dirname, "dist"),
    publicPath: "/assets", //should provide the path of the served js , img , etc...

in the above code I wrongly spet contentBase as contenBase, when I changed it back, it worked well!! You should be looking out for similar issues too


The problem is that you haven't run yarn/npm install.


I found an easy solution to this. Change the "start" script in your package.json to the following instead:

"start": "webpack serve --config webpack.config.js --open"

where webpack.config.js is your webpack config file.

I hope it works!


For me helped to run "webpack-dev-server" after I add the script to "package.json" as "start": "webpack serve --open"

Related Query

More Query from same tag