'How do I run "npm run watch" on specific address and port? (Laravel mix)
How can I run npm watch with a specific url and port?
In my package.json file I have following the line
"watch": "mix watch",
in the scripts section, which works fine with the command npm run watch and is accessed via localhost. I would like to access it at http://dev.myproject:8888 instead of localhost, as I have a number of projects.
To run npm start with a specific local url is can add the following line to the "scripts" section of my projects package.json :
"start": "http-server -a dev.myprojectname -p 8888"
(in order to this one must add dev.myprojectname to your "hosts" file, connected to 127.0.0.0)
How can I specify the same for npm watch ?
I have tried the same under watch ie :
"watch": "http-server -a dev.myprojectname -p 8888"
but this is not correct
Solution 1:[1]
I've stumbled upon the same question, so I will answer for posterity.
To pass args directly to webpack, -- --port <PORT>
did the trick.
"watch": "mix watch --hot -- --port 3080",
Hope it helps someone ;)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | DoubleCompil |