问题
How do I build an Angular CLI project in IntelliJ IDEA or Webstorm? I want an option to run ng build
command for my Angular 7 Project, instead of running it through the command prompt.
回答1:
To run ng build
, open your package.json
in IDEA (WebStorm) editor and press the run icon in the gutter to the left of the 'build"
script:
To run ng serve
, run "start"
script.
Note that the IDE auto-creates the Angular CLI Server run configuration for running ng serve
, you can use it to start the app.
See also https://blog.jetbrains.com/webstorm/2017/01/debugging-angular-apps/ - you may find this blog post helpful
回答2:
If you open up Webstorm and have alook at the top right hand side of the page you will find a dropdown saying, Angular CLI Server
. Click on the dropdown and click on Edit Configuration
.
Once you have done the above you are going to end up at this window.
Once you have that window open change the Scripts
to build
. Once you have done that you can run the Angular application normally with the green Run button at the top right of your screen
来源:https://stackoverflow.com/questions/55721508/ng-build-an-angular-7-project-in-intellij-webstorm-or-idea