简体   繁体   English

Dart Angular2 on Node.js调试

[英]Dart Angular2 on Nodejs debugging

The tutorial of angular2 with dart never actually uses a real server, always pub serve. 带有dart的angular2教程从未真正使用过真正的服务器,而始终使用pub服务。

How can I debug my dart code when using a real server like NodeJS? 使用像NodeJS这样的真实服务器时,如何调试我的dart代码? Atm I'm just getting errors like abY is not defined(in the browser), which is completely useless. Atm我只是遇到错误,例如abY未定义(在浏览器中),这完全没有用。

Is there some kind of source mapping for dart2js? dart2js是否有某种源映射?

Ok after building with pub build --mode=debug. 在使用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. chrome开发工具中提供了dart源代码(它显示了我所有dart文件的“从main.dart.js映射的源代码。”断点并没有停止。

Sounds like the problem I had with another Dart library when I tried running in another server via NGINX. 听起来像当我尝试通过NGINX在另一台服务器上运行时,另一个Dart库遇到的问题。 Is your pubspec.yaml properly set up? 您的pubspec.yaml是否正确设置?

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. 我的问题是我没有使用entry_pointstransformersentry_points部分,该pubspec.yaml会生成启动类的定义。

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

Is your pubspec.yaml similar to the Dart Angular2 example below? 您的pubspec.yaml是否类似于下面的Dart Angular2示例?

https://angular.io/docs/dart/latest/quickstart.html#!#add-config-files 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. 还要确保您通过nodejs提供build目录,因为它将编辑您的index.html并将其放在build目录中,并自动添加其他link / script行以包含其他文件。

This might also be part of the reason you can't see your breakpoints. 这也可能是您看不到断点的部分原因。 That happened to me too. 这也发生在我身上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM