Skip to content
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

Source maps for bundle mode #3247

Open
ribrdb opened this issue Mar 7, 2019 · 3 comments
Open

Source maps for bundle mode #3247

ribrdb opened this issue Mar 7, 2019 · 3 comments
Labels
internal-issue-created An internal Google issue has been created to track this GitHub issue triage-done Has been reviewed by someone on triage rotation.

Comments

@ribrdb
Copy link

ribrdb commented Mar 7, 2019

J2CL recommends using bundle mode for development, but that means we don't get any sourcemaps. Is there any reason the compiler can't generate the .map in bundle mode?

@blickly blickly added the internal-issue-created An internal Google issue has been created to track this GitHub issue label Mar 8, 2019
@blickly
Copy link
Contributor

blickly commented Mar 8, 2019

Created internal issue http://b/127860990

@blickly blickly added the triage-done Has been reviewed by someone on triage rotation. label Mar 11, 2019
@niloc132
Copy link
Contributor

niloc132 commented Nov 8, 2019

We have a rough patch that makes this possible in our build workflow, created so that https://github.com/google/j2cl/ can cleanly use sourcemaps in the browser debugger. The code in google/j2cl seems to assume that this is actually already possible:

https://github.com/google/j2cl/blob/master/build_defs/internal_do_not_use/j2cl_js_common.bzl#L44-L53

    closure_js_binary(
        name = name,
        compilation_level = "BUNDLE",
        defs = entry_point_defs,
        deps = deps,
        # For J2CL it is in impractical to embed all source into sourcemap since
        # it bloats sourcemaps as well as it slows down bundling.
        nodefs = ["--source_map_include_content"],
        **kwargs
    )

Vertispan@f64876e

Note that this patch doesn't actually bundle up sourcemaps in the JS or process in any way (merging, etc), just points to where those files are on disk, under the assumption that this is the easiest way to serve content file-by-file. Also, due to how Chrome interprets sourceURL directives in a given .js file as being relative to the original .html file, this requires that the .js file end up in the same directory as the .html file (unlike firefox, which works as I would naively expect here).

@johnthuss
Copy link

I'd really like to be able to have source maps for development using J2CL, specifically with the _dev_server task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal-issue-created An internal Google issue has been created to track this GitHub issue triage-done Has been reviewed by someone on triage rotation.
Projects
None yet
Development

No branches or pull requests

4 participants