Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between npm run watch and npm run watch-poll

What is the difference between npm run watch and npm run watch-poll in Laravel mix?

I cannot see any difference between the output they give.

like image 869
Advaith Avatar asked May 23 '17 06:05

Advaith


People also ask

What does npm run watch poll do?

watch-poll periodically checks (polls) for changes e.g. every 1000ms it will manually check to see if any files have changed. We've shown how to use programming to solve the Npm Run Watch-Poll problem with a slew of examples.

What is the difference between npm run and npm run production?

This means that npm run dev will run the dev command, while npm run production will run the production command. This means that npm will execute the next dev command when you call the npm run development command. To know the available commands for the project, you can open the package.

What does npm run mean?

npm run sets the NODE environment variable to the node executable with which npm is executed. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install , just in case you've forgotten.

What does npm run start do in Nextjs?

TL;DR: In Next. js, next dev is used to run the app in development mode. On the other hand, next start is used to run the app in production mode, but requires next build to be run first to generate an optimized production build.


2 Answers

watch will listen for file changes, however, on certain systems this won't always work.

watch-poll periodically checks (polls) for changes e.g. every 1000ms it will manually check to see if any files have changed.

https://laravel.com/docs/5.4/mix#running-mix

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

like image 59
Rwd Avatar answered Sep 28 '22 01:09

Rwd


watch-poll is an alternative to watch in certain enviroments watch might not track changes properly, therefore watch-poll was implemented.

Poll will check the files every x seconds rather than automatically picking up on changes through watching.

You can read up on the docs for a more information about mix.

like image 39
Ian Avatar answered Sep 28 '22 02:09

Ian