Gulp + live reload serves up my content on localhost and (here\'s what I\'m after) launches the browser automatically at the server url whenever i run the gulp
To launch the browser, one can add --open
to CLI command as the accepted answer points it out
npm start --open
or
ng serve --open
To avoid doing it all the time: there is a simple change to make in package.json
"scripts": {
"ng": "ng",
"start": "ng serve --open",
...
},
directory/folder: package.json
{
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"webpack": "^4.16.0",
"webpack-dev-server": "^3.1.4"
},
"name": "",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"description": "",
"author": "",
"private": false,
"scripts": {
"start": "webpack-dev-server --open --watch"
},
"dependencies": {
"webpack-cli": "^3.0.8"
}
}
This start script will run the dev server, and both automatically open and update (on-save) the web page. This is for WebPack 4.
Launch browser automatically and it is also possible to specify a page when opening the browser with webpack 4.
"scripts": {
...
"start": "webpack-dev-server --open-page index2.html"
}