Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable source map generation when using "webdev build"?

Tags:

dart

When using Dart 2 and the webdev build command, I get a build/main.dart.js file. At the end of this file, there is a comment pointing the source map:

//# sourceMappingURL=main.dart.js.map

However, this file doesn't exist. How do I get the .map file and Dart source files to show up in the build directory so that Chrome devtools will see them?

like image 838
Brian Slesinsky Avatar asked Oct 23 '25 02:10

Brian Slesinsky


1 Answers

According to the document of webdev build, you should use webdev build --no-release instead. (but this will use DDC compiler instead.)

Update info: By default, webdev build in release mode will remove all *.js.map file, so you can put a build.yaml file in your project root folder to deactivate dart cleanup source.

For example, (build.yaml file) targets: $default: builders: build_web_compilers|dart_source_cleanup: release_options: enabled: false

like image 52
jumperchen Avatar answered Oct 27 '25 03:10

jumperchen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!