Webpack launch browser automatically

前端 未结 9 968
遥遥无期
遥遥无期 2021-02-03 17:18

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

9条回答
  •  旧时难觅i
    2021-02-03 18:16

    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.

提交回复
热议问题