Uh oh!
There was an error while loading. Please reload this page.
Make the packager work with babel strict mode transform - #5422
Make the packager work with babel strict mode transform#5422janicduplessis wants to merge 1 commit into
Conversation
facebook-github-bot
commented
Jan 20, 2016
By analyzing the blame information on this pull request, we identified @vjeux, @spicyj and @davidaurelio to be potential reviewers. |
2261fba to
9701013Comparefacebook-github-bot
commented
Jan 20, 2016
@janicduplessis updated the pull request. |
There was a problem hiding this comment.
Should we get rid of the GLOBAL global variable and just use the node standard global everywhere? Except for this file it is used in 1 or 2 other places in the codebase.
There was a problem hiding this comment.
GLOBAL is valid in Node so removing it will probably break some third party npm modules.
There was a problem hiding this comment.
Ok let's leave it like this.
janicduplessis
commented
Jan 20, 2016
On a completely unrelated note that new @facebook-github-bot picture is amazing! |
satya164
commented
Jan 20, 2016
This is awesome. I was planning to work on this, but seems now I don't have to :D Thanks for working on this. |
There was a problem hiding this comment.
global-strict was replaced with strict in eslint 1.0 so it was causing some lint warnings.
davidaurelio
commented
Jan 20, 2016
@janicduplessis, thank you for the effort. I’m generally fine with the changes. Let’s clarify the open questions, especially in polyfills/document.js |
There was a problem hiding this comment.
Please remove the line break here, otherwise line numbers in redboxes will be off by one for polyfills.
facebook-github-bot
commented
Jan 20, 2016
@janicduplessis updated the pull request. |
janicduplessis
commented
Jan 20, 2016
@davidaurelio Thanks for the review, I fixed the issues concerning the navigator polyfill and the other minor stuff. The issues left are the |
davidaurelio
commented
Jan 20, 2016
Awesome, thank you! Let me know if you need any help |
janicduplessis
commented
Jan 20, 2016
@davidaurelio Should I keep support for both |
facebook-github-bot
commented
Jan 20, 2016
@janicduplessis updated the pull request. |
facebook-github-bot
commented
Jan 20, 2016
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/758031977665068/int_phab to review. |
davidaurelio
commented
Jan 20, 2016
@janicduplessis I’m sorry, but you have to rebase :-( |
25e951c to
f12879bComparefacebook-github-bot
commented
Jan 20, 2016
@janicduplessis updated the pull request. |
At the moment we have to disable strict mode for the transform-es2015-modules-commonjs because strict mode leaks to the global scope and breaks the bridge. It was due to the way the polyfills were bundled in the package. To fix it, I wrapped the polyfill modules in an IIFE. Then when strict mode was enabled some polyfills were broken due to strict mode errors so that was fixed too. Also removed the IIFE from the polyfills that included one.
f12879b to
34160e2Comparefacebook-github-bot
commented
Jan 20, 2016
@janicduplessis updated the pull request. |
janicduplessis
commented
Jan 20, 2016
@davidaurelio Rebased on master and squashed the commits. |
davidaurelio
commented
Jan 21, 2016
I tried to land immediately after you posted yesterday, and right now, but there are still conflicts in Afaik there is no need to squash your commits, btw. They will be squashed by our system anyway, so don’t worry doing it. |
janicduplessis
commented
Jan 21, 2016
@davidaurelio Hmm weird, right now it says the branch has no conflicts. If you want to fix the conflicts manually what I did for these 2 files is simply take the version from master and then remove the extra closure scope that is not needed anymore. |
janicduplessis
commented
Jan 21, 2016
It seems like you still have the version before I rebased since that's the 2 conflicts I fixed, not sure how your system works exactly but maybe try reimporting it since I rebased it may have trouble updating my branch. |
davidaurelio
commented
Jan 21, 2016
ok, it’s supposed to update itself. Let’s try to ship from here. |
davidaurelio
commented
Jan 21, 2016
@facebook-github-bot shipit |
facebook-github-bot
commented
Jan 21, 2016
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/758031977665068/int_phab to review. |
davidaurelio
commented
Jan 21, 2016
ok, the patch succeeded. Unless any internal tests fail this PR should get closed soon :-) |
satya164
commented
Jan 21, 2016
🎉 |
corbt
commented
Jan 21, 2016
👍 * 💯 |
Summary: At the moment we have to disable strict mode for the transform-es2015-modules-commonjs because strict mode leaks to the global scope and breaks the bridge. It was due to the way the polyfills were bundled in the package. To fix it, I wrapped the polyfill modules in an IIFE. Then when strict mode was enabled some polyfills were broken due to strict mode errors so that was fixed too. Also removed the IIFE from the polyfills that included one. This diff doesn't enable the strict mode transform since some internal facebook modules depend on it not being enabled. When react#5214 lands we could make the default babel config shipped with OSS react-native use strict mode modules and facebook could just modify the babel config to disable it if needed. This will allow removing `"strict": false` from https://github.com/facebook/react-native/blob/master/packager/react-packager/.babelrc#L16Fixesreact#5316Closesreact#5422 Reviewed By: svcscm Differential Revision: D2846422 Pulled By: davidaurelio fb-gh-sync-id: a3e2f8909aa87dabab2b872c61b887e80220fb56
Summary:Since #5422 react-native works with strict mode modules but the transform was not updated since Facebook has some non strict mode compatible internal modules. Now that #5214 has landed and it is easy to change the babel config I think we should enable it by default to make es2015 modules spec compliant. Someone at Facebook will have to make the internal changes necessary to disable strict mode modules for their projects that use non strict mode compatible modules by including a .babelrc file with ``` json { "presets": [ "react-native" ], "plugins": [ ["transform-es2015-modules-commonjs", { "strict": false, "allowTopLevelThis": true }] ] } ``` before merging this. We might also want to mention this in the breaking change section for the next release. Closes#5796 Differential Revision: D3075802 fb-gh-sync-id: e807b67401107e1e944db38453e254025ce0a6c7 shipit-source-id: e807b67401107e1e944db38453e254025ce0a6c7
Summary: At the moment we have to disable strict mode for the transform-es2015-modules-commonjs because strict mode leaks to the global scope and breaks the bridge. It was due to the way the polyfills were bundled in the package. To fix it, I wrapped the polyfill modules in an IIFE. Then when strict mode was enabled some polyfills were broken due to strict mode errors so that was fixed too. Also removed the IIFE from the polyfills that included one. This diff doesn't enable the strict mode transform since some internal facebook modules depend on it not being enabled. When #5214 lands we could make the default babel config shipped with OSS react-native use strict mode modules and facebook could just modify the babel config to disable it if needed. This will allow removing `"strict": false` from https://github.com/facebook/react-native/blob/master/packager/react-packager/.babelrc#L16 Fixes #5316 Closesreact/react-native#5422 Reviewed By: svcscm Differential Revision: D2846422 Pulled By: davidaurelio fb-gh-sync-id: a3e2f8909aa87dabab2b872c61b887e80220fb56
At the moment we have to disable strict mode for the transform-es2015-modules-commonjs because strict mode leaks to the global scope and breaks the bridge. It was due to the way the polyfills were bundled in the package. To fix it, I wrapped the polyfill modules in an IIFE. Then when strict mode was enabled some polyfills were broken due to strict mode errors so that was fixed too. Also removed the IIFE from the polyfills that included one.
This diff doesn't enable the strict mode transform since some internal facebook modules depend on it not being enabled. When #5214 lands we could make the default babel config shipped with OSS react-native use strict mode modules and facebook could just modify the babel config to disable it if needed.
This will allow removing
"strict": falsefrom https://github.com/facebook/react-native/blob/master/packager/react-packager/.babelrc#L16Fixes#5316