mp3por
mp3por

Reputation: 1852

How to run angular2 cli project in intellij

I am developing an Angular2 project generated by angular-cli ( latest ). I want to run everything within Intellij however I can not find a way to do it. Currently I only develop in Intellij but run everything from the console ( 'npm start' ). This is very troublesome however because

  1. When I change files the webpack does not always see the changes - I think Intellij is caching the changes or something

  2. I can not debug in Intellij only in console of the browser

My question is : How to set up Intellij to do everything that 'npm start' does ( auto compile files and generate maps, watch for changes, serve the files ) so that everything is handled by Intellij and I can use it's full functionality ?

Best regards

Upvotes: 3

Views: 6792

Answers (3)

Mohamed GAFSIA
Mohamed GAFSIA

Reputation: 59

Upvotes: 1

IntelliJ is primarily intended for Java development while WebStorm is primarily intended for Web development, particularly Angular, with or without Angular-CLI.

Since you are creating an Angular application with a JetBrains.com tool, you should use the JetBrains.com tool that is specifically targeted to Angular development, which is JetBrains WebStorm, not JetBrains IntelliJ.

Upvotes: 0

lena
lena

Reputation: 93748

To run Angular application created with angular-cli in IDEA, you have to run npm start from NPM Tool Window to start the application, create JavaScript Debug run configuration for http://localhost:4200/ URL and hit Debug.

See https://blog.jetbrains.com/webstorm/2017/01/debugging-angular-apps/, https://www.youtube.com/watch?v=upgjCMHGpwo for more info. See also https://blog.jetbrains.com/webstorm/2016/04/angular-2-workflow-in-webstorm/

Note that you might face issues when debugging on Windows because of recent changes in angular-cli configuration: currently webpack generates absolute Windows paths in sourcemap that break the debugging (WEB-27381). See https://youtrack.jetbrains.com/issue/WEB-27381#comment=27-2249117 for possible workaround

Upvotes: 4

Related Questions