Webpack launch browser automatically

前端 未结 9 943
遥遥无期
遥遥无期 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条回答
  •  别跟我提以往
    2021-02-03 17:54

    For those using Node.js (and npm): put the command in the npm start script:

    MAC

    "scripts": {
        "start": "webpack-dev-server & open http://localhost:8080/"
      }
    

    WINDOWS

    "scripts": {
        "start": "start http://localhost:8000/ & webpack-dev-server"
    }
    

    Thanks to Enzo Ferey for pointing out that the command needs to look different when on Windows.

提交回复
热议问题