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

Fix browser bundle for AMD #8374

Merged
merged 3 commits into from Nov 23, 2016
Merged

Fix browser bundle for AMD #8374

merged 3 commits into from Nov 23, 2016

Conversation

zpao
Copy link
Member

@zpao zpao commented Nov 22, 2016

Fixes #8301

I confirmed that the webpack bundling that got us into this situation is still ok so I think this should be safe. I didn't explicitly check SystemJS but I think it should be in the same boat.

cc @gaearon

@zpao
Copy link
Member Author

zpao commented Nov 22, 2016

For anybody following along at home, this doesn't fix SystemJS. I was definitely wrong to assume that. It gets detected as AMD in the outer wrapper but it's define resets and the inner wrapper doesn't detect as AMD, falling back to the global.

Much more scientific than the rest so it should stick.
function wrapperify(src) {
src = src.replace('define([],f)', 'return f()');
src = src.replace(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's throw if there are no matches.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done.

@sophiebits sophiebits merged commit a3ba48b into facebook:master Nov 23, 2016
sophiebits pushed a commit that referenced this pull request Nov 23, 2016
* Fix browser bundle for AMD

* Final fix for standalone browser build.

Much more scientific than the rest so it should stick.

* Throw when we can't find code we need to replace.

(cherry picked from commit a3ba48b)
@gaearon gaearon added this to the 15.4.1 milestone Jan 6, 2017
acusti pushed a commit to brandcast/react that referenced this pull request Mar 15, 2017
* Fix browser bundle for AMD

* Final fix for standalone browser build.

Much more scientific than the rest so it should stick.

* Throw when we can't find code we need to replace.
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.

None yet

4 participants