Dart to JS: how to debug generated Javascript errors

Currently, Javascript generated by the dart2Js converter is very unintuitive to debug and does not generate clear error messages.

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

I would like to go to the Dart line which is responsible for the error.

It would also be great to see the underlying dumps and stack frames in terms of Dart code.

+5
source share
1 answer

First, make sure you build with pub build --mode=debug .
This prevents mineralization and shaking of the trees.

Make sure the 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 the Dart source code when passing through.

Polymer.dart

It seems that the problem by which the default script is used does not refer to the source maps. How to make a pub to use the source maps on projects with fractional polymer

+4
source

Source: https://habr.com/ru/post/1201647/


All Articles