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

Bundle with rollup: es6 imports, cycles in JS source, ReactNative getters #15233

Closed
EmielM opened this issue Jul 27, 2017 · 4 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@EmielM
Copy link
Contributor

EmielM commented Jul 27, 2017

I had a go at getting react-native bundled with https://github.com/rollup/rollup.

Config: https://gist.github.com/EmielM/0d59a0c4e711ace245ab736f208fc6be

  1. I would like to output in iife form (eg just execute modules in order). That doesn't really work (that well) with cyclic requires, of which I encountered a few: https://pastebin.com/cWfGG1Am. Is the idea to - at some point - try to phase out these cyclic requires? There are some hints in the source suggesting these cycles are unintentional. Or should I come up with a different way to bundle?

  2. My rollup config currently transforms the require() calls back to import/export format. That doesn't really work that great with tree shaking and takes a lot of time. Is there somewhere on the roadmap to move to import/export?

  3. Same for the whole haste @providesModule system, although the haste loader is only 20 lines or so.

  4. react-native-implementation.js has this very weird way of defining its exports using getters. That obliterates any tree shaking possibilities. Is that a design choice? As I can tell, this results in the modules to only be evaluated when used -- and that would mean their side effects aren't really that important making them ideal candidates for pruning using tree shaking.

Thanks!

@hramos
Copy link
Contributor

hramos commented Jul 27, 2017

Closing this as it doesn't seem to report a particular issue with React Native itself. If you disagree, can you take a look at the issue template and edit your post to fit the guidelines?

@hramos hramos closed this as completed Jul 27, 2017
@EmielM
Copy link
Contributor Author

EmielM commented Jul 27, 2017

Pff, it's not a particular issue -- but how else is someone supposed to have a discussion about the architecture/engineering decisions taken by the react-native team that now affect thousands of developers not particularly tied to the internal fb system?

Properly supporting rollup, webpack and possibly other bundlers would - not only in my opinion - be a meaningful step into making react-native more available to anyone. I'd like to help - and in fact have figured out most of the internals of the not-so-stellarly-documented rn-packager (now called metro) myself.

But I'm not ready to put in days of development without having an idea of where you folks are heading. This would seem like the proper forum where both react-native developers and the community can voice their ideas and/or help out.

My most important specific/concrete question is about the cyclic dependencies. Is this a bug, or intented behavior?

@hramos
Copy link
Contributor

hramos commented Jul 27, 2017

There's actually several places, and they are all listed in the contribution guide that is linked from the top of the template that is shown when you open a new issue. Here's the link: http://facebook.github.io/react-native/docs/contributing.html#how-to-get-in-touch

For discussion-type issues, an exception can be made for skipping the template -- just make it very clear that you're looking to start a discussion. At some point we're going to switch to having all issues automatically close if the template is not followed, so I'm just trying to figure out a way of properly flagging when an issue is submitted for discussion.

When I see phrases such as "is this a bug" and the issue skipped the whole template, my first assumption is that you did not read the template and are not intentionally proposing a change. I apologize if I made the wrong assumption.

@hendrul
Copy link

hendrul commented Mar 17, 2018

Ok so this ain't get solved, and is closed?

@facebook facebook locked as resolved and limited conversation to collaborators Jul 27, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants