Use npm-watch to auto build your ReactJS app

Manish Mandal
How To React
Published in
2 min readJul 27, 2019

Today I’ll show you how to auto build your ReactJS app.

So what npm-watch actually do? npm-watch run scripts from package.json when there is any changes in your app folders or files. It’s useful when you want to automate your build in server when there is any change.

Requirements

  1. Create your react app.
  2. Install npm-watch.
npm install npm-watch

3. Now open your app package.json file in your favorite code editor and inside the scripts object insert this .

"watch": "npm-watch",

4. Now insert a new object anywhere in your package.json file.

"watch": {
"build": {
"patterns": [
"src"
],
"extensions": "js,jsx"
}
},

5. Your package.json file will look something similar to this.

6. Now run this command in your terminal.

npm run watch

This will look for any changes in your src folder and files with extensions js, jsx and auto create a build each time you make changes.

For more options like delay, ignore, extensions etc visit npm-watch

Here is the GIT repository for that

--

--

Manish Mandal
How To React

Full Stack Developer | React JS | Next JS | Node JS | Vue JS | Wordpress. Connect with me https://www.linkedin.com/in/manishmandal21/