dev_compiler
dev_compiler copied to clipboard
most source map paths are off by one
Here's my setup:
- most dart code is in the
lib/folder - a single entry-point file is in
web/(web/entry.dart) - all DDC output written to
web/ddc/ - a DDC entry-point file is generated in
web/entry_all.jswhich basicallyrequires all the generated DDC sources inweb/ddc/
Most of the generated source maps have incorrect paths.
web/ddc/entry.js.map has ../entry.dart for sources: (which is correct)
For package refs, web/ddc/logging/logging.js.map has ../../../logging/logging.dart. This is off-by-one; it should point to ../../../packages/logging/logging.dart.
For self-refs, web/ddc/atom_flutter/state.js.map points to ../../../atom_flutter/state.dart. It should probably point to ../../../lib/state.dart, or perhaps to ../../../packages/atom_flutter/state.dart.
I'm going to take a quick look through the source to see if the problem jumps out at me.
Good catch! Path computation happens at: https://github.com/dart-lang/dev_compiler/blob/e465c1df13f9ad50b5dff3e120fe116718561753/lib/src/compiler.dart#L417
I think the "packages" magic happens here: https://github.com/dart-lang/dev_compiler/blob/e465c1df13f9ad50b5dff3e120fe116718561753/lib/src/codegen/code_generator.dart#L79
The two do not appear to know about each-other...
(not sure this is low priority ... if I understand correctly, source maps are busted in all packages?)
I removed the priority label :) For me, the generated JS is clear enough that this doesn't impact the difficulty of debugging the code too much.