-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Packager] ES6 Modules feature #1480
Comments
More detail: #1451 I'm going to just use browserify + babelify before sending files to the packager to get around these issues. I'll post an example in an hour or so. EDIT: This doesn't work. |
@jtremback you can just use the babel cli tool directly to pre-compile, but being able to do this directly in the react-native packager would be much nicer. Below is an example script I added to my package json to do this.
Then just make your require('./lib'); One thing to note: Sometimes the react packager runs after the babel compile so you need to save twice to see your changes. |
@euforic I rather modify packager/transformer.js and add @jtremback any news on your side? Do you think we might be able to override whitelist with |
@jtremback @alinz I hacked together some of my build scripts into a makeshift cli tool if you guys are still looking for a fix. It's definitely not my best work but It has been getting me by until es6 modules work in the packager. Github: bh5-js/rctapp It can do the following:
|
@euforic 👏 |
@brentvatne Do you know any way to get Need HELP please... |
Hi @alinz - I believe this is related to #1924 Try making this simple change to node_modules/react-native/packager/packager.js: https://gist.github.com/brentvatne/794a77917d7a4b3cce5b/revisions (the one line resetCache option) This is an example of a working babelrc: https://github.com/brentvatne/react-native-animated-demo-tinder/blob/master/.babelrc |
@brentvatne thanks a lot. It works. |
@brentvatne @alinz Just a heads up. I added support to the rctapp tool to clean the cache |
If anyone else encounters this issue, where you have a .babelrc file but React Native won't use your ES6/ES7 settings, please try the rctapp provided by @euforic This worked great for me. I ran |
I'm not clear how to get es6 modules in a new RN 0.16.0-rc project. |
@quantuminformation:ES6 modules are already supported by default in React Native. However there are some bugs preventing it to work in 0.16.0-rc, which will be fixed in 0.16.0 |
One of the feature that I really want to have is the new module syntax in
es6
. By brining Babeljs into the eco system I thought I can use it. Unfortunately,es6.modules
are not part of the whitelist :(To me
es6 module
removes a lot of code and makes the code more readable and clean.Any thoughts on this?
p.s. I know module feature is not ready yet, but the whole point of using Babel is to use the next generation syntax safely. Well, I hope I my assumption is right. :D
The text was updated successfully, but these errors were encountered: