Automatic build in Webpack

You can make Webpack track changes to project files and run the build itself every time. To do this, you need to make the following setting in scripts:

package.json"watch": "webpack --mode development --watch"

As a result, our package.json file will look like this:

package.json"scripts": {
  "build": "webpack",
  "dev":   "webpack --mode development",
  "prod":  "webpack --mode production",
  "watch": "webpack --mode development --watch"
},

You can start file tracking with the following command:

terminalnpm run watch

After this, you won't be able to enter any commands into the terminal until you interrupt monitoring with the Ctrl + C command.

Задание 1

Update your package.json with the appropriate settings.

Задание 2

Run Webpack in watch mode.

Задание 3

Make changes to the project files. Check that the automatic build will occur.

Задание 4

Stop tracking with the appropriate command.