I used [email protected] before and now I updated to angular-cli@webpack beta.11. After a lot of custom changes I got it to work.
The only thing is that now I can not debug my angular app using webstorm and chrome debugger because I don't get any ts files using ng serve. With [email protected] it was very easy to debug my app using the Jetbrains Plugin.
How can I debug my angular app with Webstorm and the Chrome Debugger using ng serve?
The Angular CLI can create a new Angular project and it will handle the webpack configuration.
You can use source maps to preserve the mapping between your source code and the bundled/minified one. Webpack provides the devtool option to enhance debugging in the developer tool just creating a source map of the bundled file for you. This option can be used from the command line or used in your webpack.
Once SPFx application is served on localhost, add the webpart which includes the angular element. To debug this element open developer tools and search the angular element component. ts file in sources, add the breakpoint in component and test it.
The new angular/cli version uses webpack which does not compile the ts files to an local directory like dist before (till beta 1.0.0-beta.10). Now it uses some memory like approach.
But you can find the ts Files in the Chrome Developer Tools in the "Sources" tab.
Notice: This solution was tested with version 1.0.0-beta.26 and 1.2.1
Notice: In this example I used port 5321 instead of 4200. Just use your port.
While running ng serve (also used in npm start), you can find your sources in the Chrome Developer Tools section: "webpack://":
Just edit your Run/Debug Configuration in Webstorm/PHPStorm to following:
webpack://.
webpack://./src
While running ng serve (also used in npm start), you can find your sources in the Chrome Developer Tools section: "webpack://":
Just edit your Run/Debug Configuration in Webstorm/PHPStorm to following: Set your Remote URL Path of your project directory to
webpack:////Users/...FULL_PATH.. //on Mac OSX
or
webpack:///C:/...FULL_PATH.. //example on Windows
Notice: on Windows you only need 3 slashes, on Mac you need 4 slashes after "webpack:"
You can also check your Path by going to http://localhost:4200/main.map and search for any ".ts" File. You can easily copy the path of this file and paste it to your IDE Configuration Dialog.
EDIT: Perhaps you need to map the path adding "/src" to your src folder too. Thanks @born2net
Have Fun.
ok got it working, you need to map both root and src. see here:
hopefully it helps someone,
let me add that sometimes the debugger will miss your breakpoint so add alert('foo') or ;debugger code just before your breakpoint.
tx
will be adding and convering jspm projects to new cli Angular 2 Kitchen sink: http://ng2.javascriptninja.io and source@ https://github.com/born2net/ng2Boilerplate Regards,
Sean
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With