Skip to content

Update sourcemap implementation#19

Open
jRiest wants to merge 9 commits intopetehunt:sourcemapsfrom
jRiest:sourcemaps
Open

Update sourcemap implementation#19
jRiest wants to merge 9 commits intopetehunt:sourcemapsfrom
jRiest:sourcemaps

Conversation

@jRiest
Copy link
Copy Markdown

@jRiest jRiest commented Aug 26, 2014

Implementing sourcemaps according to the feedback from @sokra. I also merged in the latest changes from master.

@jRiest jRiest mentioned this pull request Aug 26, 2014
@jbaiter
Copy link
Copy Markdown

jbaiter commented Aug 26, 2014

👍 Works fine here :-)

@gaearon
Copy link
Copy Markdown
Contributor

gaearon commented Aug 27, 2014

Does source map need to be opt-in via flag? @sokra, is this the recommended way?

If so, I'd appreciate the docs explaining how to combine flags (I presume ?harmony&sourceMap should work but I'm not sure).

@sokra
Copy link
Copy Markdown

sokra commented Aug 27, 2014

I doesn't need to be opt-in... If you don't use a source-map devtool it's ignored...

The other loaders always emit source-maps...

@jRiest
Copy link
Copy Markdown
Author

jRiest commented Aug 27, 2014

No problem. I changed it to always emit them. @sokra perhaps we could have some sort of flag at the loader level which would allow loaders to skip source map generation if it is not necessary.

@sokra
Copy link
Copy Markdown

sokra commented Aug 27, 2014

yup... I'll add one...

@petehunt
Copy link
Copy Markdown
Owner

If they always emit source maps it could contribute to increased build time, no?

Sent from my iPhone

On Aug 27, 2014, at 7:56 AM, "Tobias Koppers" <notifications@github.commailto:notifications@github.com> wrote:

yup... I'll add one...


Reply to this email directly or view it on GitHubhttps://github.com//pull/19#issuecomment-53584642.

@sokra
Copy link
Copy Markdown

sokra commented Aug 28, 2014

this.sourceMap

@sokra
Copy link
Copy Markdown

sokra commented Aug 28, 2014

@petehunt yes... we may need to patch the loaders to use the new flag...

@jRiest
Copy link
Copy Markdown
Author

jRiest commented Aug 28, 2014

@sokra @petehunt I updated it to read the new flag. However, as it stands now, source maps won't be enabled for anyone using webpack < 1.4.0-beta1. Is this the preferred way to handle it, or would it be better to do something like this, where we read the flag if it's there, otherwise we automatically emit source maps?

var result = reactTools.transformWithDetails(source, {
  harmony: query.harmony,
  sourceMap: typeof this.sourceMap === 'boolean' ? this.sourceMap : true
});

Since this loader has not had source map support before I could go either way, but for loaders that currently always emit source maps, I would assume they would take the above approach so as to not break for people who don't update their webpack version.

@gaearon
Copy link
Copy Markdown
Contributor

gaearon commented Sep 3, 2014

@sokra @petehunt

What do you think? Ideally I'd like to wait for this before merging gaearon/react-hot-loader#23.

@sokra
Copy link
Copy Markdown

sokra commented Sep 5, 2014

Looks good 😄

@gaearon
Copy link
Copy Markdown
Contributor

gaearon commented Sep 9, 2014

@petehunt If nothing is blocking, can you bring this in?

gaearon added a commit to gaearon/jsx-loader that referenced this pull request Oct 9, 2014
Webpack already [gives us this.sourceMap](petehunt#19 (comment)), so we should use it.
It will be `false` if user doesn't emit source maps in config.
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.

7 participants