6

Currently, the Javascript generated by dart2Js converter is very unintuitive to debug and doesn't produce intelligible error messages.

Is there a specific way that people use to debug Javascript code generated by dart?

I would like to get to the Dart line that is responsible for the error.

Also it would be great to see core dump and stack frames in terms of Dart code.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Ravi Teja Gudapati
  • 2,809
  • 2
  • 13
  • 16

1 Answers1

5

At first ensure that you build with pub build --mode=debug.
This prevents minification and tree shaking.

Ensure that source maps are activated in Chrome devtools.
(DevTools settings - General - Sources - Enable JavaScript source maps).

Launch the application and debug.
The Chrome debugger should now show Dart source code when stepping through.

Polymer.dart

There seems to be an issue that the script used by default doesn't reference source maps How make pub build to use source maps on dart polymer projects

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567