-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map files from 'pub build' #22174
Comments
Pub will default to creating source maps in debug mode, but not in release mode since release mode doesn't include any Dart sources anyway. Generally we recommend using "pub serve" during development, but if you want to use "pub build" you can pass the --debug flag to include the Dart sources and source maps. Added AsDesigned label. |
Natalie, Can we get: minified code From pub build, in any way? I know we can with dart2js Thanks! |
Yeah, not doing this by default is deliberate, but I think it may be useful to allow it. See: https://groups.google.com/a/dartlang.org/forum/#!topic/misc/ZnSlw5lKTqU Removed Type-Defect, Priority-Unassigned labels. |
Marked this as being blocked by #16645. |
You have to have 'release' maps available. If you don't, you cannot easily track down where crashes are coming from in the source. In live applications it will happen that bugs are found that can only be reproduced in the release build. Developers absolutely need access to map files for release builds in these circumstances. |
Added C5 label. |
Bumping to high for our customer. Thanks for taking a look! Removed Priority-Medium label. |
We'd like to propose a workaround: Can you try: pub build --debug AND add minify:true To your $dart2js transformer in your pubspec.yaml? |
That could work, but it would mean having to modify the pubspec file to switch between a debug build and a release build. It would be better to have the option available as a build flag like "pub build --release --output_maps" |
What's the difference between a debug build and a release build, if we set minify:true + mode=debug? |
Sorry I wasn't clear. A debug build is not minified but a release build is minified. We'd want map files for both. We actually do find ourselves debugging the dart2js generated js, so having non-minified builds available is necessary. |
Ah, yup! So the suggestion is: (and it's up to you to tell us if it's sufficient) from the command line, do: pub build --deploy from inside your pubspec.yaml file, do this: transformers:
We think this gives you want you want: * Minified output
Please give it a try and let us know if this works for you. Thanks! |
The problem with this solution is that we ALWAYS get minified code unless we modify the pubspec.yaml file as part of the build process. It seems like adding a command line flag to produce map files in release would be a much better solution. Is there a reason this isn't desired? Seems like anyone trying to support a live service would want it. |
This comment was originally written by @zoechi If there was a way to pass pubspec.yaml as file path or to read from stdin the whole flexibility/configurability for pub build could be managed externally by various tools. |
Added Accepted label. |
Landed r43536 which adds a 'sourceMaps' boolean option to the $dart2js transformer in pub. If specified, pub emits sourcemaps based on the value; otherwise the beahviour is as previously, i.e., driven by --mode=release/debug. To always emit sourcemaps, add: $dart2js: to your pubspec.yaml Added Fixed label. |
Thanks Chris. Can we set this from the command line? |
This issue has been moved to dart-lang/pub#1236. |
What steps will reproduce the problem?
1."dart2js -m test.dart" generates a source map file.
2.'pub build' does not generate a map file
What is the expected output? What do you see instead?
We want map files from pub build
What version of the product are you using?
1.8.3
On what operating system?
Mac/Win/Linux
Please provide any additional information below.
As we added transformers to our build we had to move away from calling dart2js directly and use 'pub build', which works, but we lost the ability to create map files for our release builds. I'd like to request optional map file generation for pub build.
The text was updated successfully, but these errors were encountered: