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

Generate Source Maps #8245

Closed
mramato opened this issue Oct 3, 2019 · 2 comments · Fixed by #10399
Closed

Generate Source Maps #8245

mramato opened this issue Oct 3, 2019 · 2 comments · Fixed by #10399

Comments

@mramato
Copy link
Contributor

mramato commented Oct 3, 2019

Now that we have switched over to roll-up with #8224, it should be straightforward to generate sourcemaps for our code. The only tricky part may be our use of pragmas which remove code from the "built" version. But roll-up hasn't let me down yet so there's a good chance it will "just work"

@kring
Copy link
Member

kring commented Mar 19, 2020

#8659 adds sourcemaps for the unminified build. I tried adding them for the minified too, but it didn't go well. The debugger ended up in totally wrong locations.

Removing uglify fixed it, but I'm not sure why uglify would be the problem because sourcemaps are supposed to work with rollup+uglify.

To try it, add this to the end of rollup-plugin-strip-pragma's transform function:

            if (options.sourcemap !== false) {
                result.map = magicString.generateMap();
            }

And change the two places in gulpfile.cjs with "sourcemap": debug to "sourcemap": true.

@fredj
Copy link
Contributor

fredj commented Mar 20, 2020

I haven't tried but the latest version of magic-string fixes a bug related to the source map:
https://github.com/Rich-Harris/magic-string/blob/master/CHANGELOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants