Set default host and port for ng serve in config file

后端 未结 12 2226
庸人自扰
庸人自扰 2020-12-07 07:53

I want to know if i can set a host and a port in a config file so I don\'t have to type

ng serve --host foo.bar --port 80

instead of just

12条回答
  •  青春惊慌失措
    2020-12-07 08:32

    here is what i put into package.json (running angular 6):

    {
      "name": "local-weather-app",
      "version": "1.0.0",
      "scripts": {
        "ng": "ng",
        "start": "ng serve --port 5000",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
    

    Then a plain npm start will pull in the contents of start. Could also add other options to contents

提交回复
热议问题