Set default host and port for ng serve in config file

后端 未结 12 2159
庸人自扰
庸人自扰 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:33

    As of right now that feature is not supported, however if this is something that bothers you an alternative would be in your package.json...

    "scripts": {
      "start": "ng serve --host foo.bar --port 80"
    }
    

    This way you can simply run npm start

    Another option if you want to do this across multiple projects is to create an alias, which you can potentially name ngserve which will execute your above command.

提交回复
热议问题