What does scripts "npm run dev" and "npm run watch" is used for?
Technically those will just run whatever scripts are defined in your package.json
with the name dev
and watch
. Without seeing your package.json
it's impossible to know exactly what they do.
For most project configurations those commands will compile your Vue components into raw javascript. The difference between dev and watch is the dev
command will compile the code then exit while the watch
command will compile the components then watch the files and recompile when one of them changes.
npm run dev
combines all your Vue components and other JavaScript files into a browser-friendly combined file.
npm run watch
does the same, but then it stays active and "watches" for updates to your .vue
and .js
files. If it detects a change, it'll re-build the browser-friendly file so you can just refresh the page.