DaafVader
DaafVader

Reputation: 1754

Dart Angular2 on Nodejs debugging

The tutorial of angular2 with dart never actually uses a real server, always pub serve.

How can I debug my dart code when using a real server like NodeJS? Atm I'm just getting errors like a.b.Y is not defined(in the browser), which is completely useless.

Is there some kind of source mapping for dart2js?

Ok after building with pub build --mode=debug. The dart source is available in chrome dev tools (it shows "source mapped from main.dart.js" for all my dart files. Breakpoints are not stopping tho.

Upvotes: 0

Views: 141

Answers (1)

Tek
Tek

Reputation: 3070

Sounds like the problem I had with another Dart library when I tried running in another server via NGINX. Is your pubspec.yaml properly set up?

My issue was that I wasn't using the transformers or entry_points section of the pubspec.yaml which generates definitions of start up classes.

https://stackoverflow.com/a/38284430/174368

Is your pubspec.yaml similar to the Dart Angular2 example below?

https://angular.io/docs/dart/latest/quickstart.html#!#add-config-files

Also make sure you serve the build directory via nodejs because it'll edit your index.html put it in the build directory and add automatically other link/script lines to include other files.

This might also be part of the reason you can't see your breakpoints. That happened to me too.

Upvotes: 1

Related Questions