Change port in package json for local development in npm run watch
Saibal Roy • January 1, 2020quick-tips
Welcome to my website and this is Saibal with yet another post to share my knowledge with you all.
Well, since visuals are more powerful than words. That's true and makes the demonstration more understanding.
As you all can see the image in this page reflects the most used package.json scripts that is mostly used with the projects using webpack.
This is what happened to me is that by default it took the port 3000 after running the command
npm run watch
I was finding a quick way to have this run on a different specified port by me for the purpose of local development. Using the --port option in the command gives me an easy solution.
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --env=local --port=3004 --config=node_modules/laravel-mix/setup/webpack.config.js
Happy learning folks!