0

I have a question regarding webpack config files.

I'm new at this technology.

So far everything was working well until I changed the name of the webpack.config.js file to webpack.dev.js.

Now the js in the dist folder do not updated when I edit the index.js file.

Can someone have a clue ?

Here is my repository where there is all the file : https://github.com/mln95/udacity-question

Thank you for your help.

Best regards,

Mohamed.

Mln954
  • 57
  • 7

1 Answers1

1

This should work like this - add the name of the config file in the build command.

"scripts": {
  "build": "webpack --config prod.config.js"
}

Source: https://webpack.js.org/configuration/

Happy coding!

Zelter Ady
  • 6,266
  • 12
  • 48
  • 75
  • Thank you for your help. It doesn't work as expected. Let me explain: I do what you have said : "build": "webpack --config webpack.dev.js" and then I write this command line : npm run build. After that I do this command : npm start and then I launch the local host on the port concerned. In this case it works no problem. But If I do this command it doesn't work : npm run build-dev. Something is loading; but what is loading is the version f the webpage when I had the file webpack.config.js . The webpack.config.js run on port 3000, but I don't know why the webpack.dev.js make things on port 8080. – Mln954 Mar 04 '21 at 14:01
  • when I do the following command : npm run build-dev no change is added on the file inside the dist folder. For instance I do a change in JS file what should appear on the main.js file on the dist folder, but with the npm run build-dev nothing is updated... But with the npm run build command it works just fine. – Mln954 Mar 04 '21 at 14:05
  • Thank you I have found the answer : https://stackoverflow.com/questions/42473979/webpack-dev-server-not-updating-bundle-when-saving-file/42475466 – Mln954 Mar 04 '21 at 14:57
  • The webpack --config prod.config.js should be added to any npm command bundle. When you run "npm run dev-build" you run the set of commands defined under "dev-build" property in package.json. You should change the command there so it will use the correct webpack configuration file. – Zelter Ady Mar 05 '21 at 09:58