Skip to content

Implement source maps#23

Closed
jRiest wants to merge 4 commits intogaearon:masterfrom
jRiest:sourcemaps
Closed

Implement source maps#23
jRiest wants to merge 4 commits intogaearon:masterfrom
jRiest:sourcemaps

Conversation

@jRiest
Copy link
Copy Markdown

@jRiest jRiest commented Aug 27, 2014

Here's a basic implementation of source maps (fixes #3).

jsx-loader isn't emitting source maps yet but I have pull request open (petehunt/jsx-loader#19) which would add that. With this pull request it will pick up the source map whenever jsx-loader sends it, otherwise it'll just proceed without a source map like it does currently.

In order to keep the mapping really simple, I switched all __hotUpdateAPI references to __HUA in order to match the character length of React. This simplifies that transform so we don't have to update the source mappings that come from jsx-loader wherever we make a replacement, but we could do that instead if necessary.

Jake Riesterer added 3 commits August 26, 2014 21:55
@gaearon
Copy link
Copy Markdown
Owner

gaearon commented Aug 27, 2014

That's amazing! Nice idea with __HUA 👍
I'll test it on my project and hopefully merge today!

@gaearon
Copy link
Copy Markdown
Owner

gaearon commented Sep 3, 2014

Sorry for the long delay. Ideally I'd like to merge this after petehunt/jsx-loader#19 gets through.

Would you mind adding this.sourceMap check?

@jRiest
Copy link
Copy Markdown
Author

jRiest commented Sep 3, 2014

No problem. If this.souceMap === false source maps will no longer be emitted.

@gaearon
Copy link
Copy Markdown
Owner

gaearon commented Sep 20, 2014

Since we're waiting for petehunt/jsx-loader#19 and I had to move all hot loader code to top, I decided to collapse all hot loader code into one line so it doesn't obscure each file. This isn't as nice as source maps, but on the upside it works with devtool: eval (which is faster).

This will require a few adjustments in your PR but before doing them, let's wait for JSX source map support to land.

@gaearon
Copy link
Copy Markdown
Owner

gaearon commented Oct 10, 2014

Thank you again! Source maps are in 0.5.0.
I needed to tweak this PR so I did it via a separate commit, but it's really thanks to you that we have this.

@gaearon gaearon closed this Oct 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emit sourcemaps

2 participants