-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Adopt flat bundles #1590
Comments
We are a few days away from Making Travis Green Again and since the bundling/building is not used internally, this could be a great external contribution. I'll give @leebyron a chance to chime in who know the node landscape a bit better. |
FWIW we still |
Re: #1321 Having the |
Oh I see. We do hoist them in our React flat bundles. // all flattened modules below are using those
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/* code */ |
This would be great! Right now we're using webpack to create these, but I agree that using Rollup would be better. I think this is a great task for someone looking to contribute to work on |
I opened a PR for this here: #1610 |
Haven't used them myself yet, but webpack (as of v2) also has some support for tree-shaking features pioneered in Rollup. |
@wincent unfortunately tree shaking is broken in webpack, see webpack/webpack#2867 |
Looks like webpack 4 is promising to fix this webpack/webpack#2867 (comment). @robrichard is tree shaking the main motivation for this issue and linked PR? |
I don't think so. This is beneficial for many reasons. In our case the main benefits were caching |
@gaearon That’s great info, thanks 👍 @kassens Then I guess the question remains, is it possible to adopt ES6 modules in Relay from FB’s perspective? |
I'd like to start working on this again. I'm going to abandon the current (new very outdated) PR and start fresh. I'm very interested in getting this working as it would solve the server side rendering performance degradation described in #1321 (comment) without degrading client side performance. I think the most incremental approach would be separate PRs that do something like this:
@jstejada @alloy do you think this makes sense? Is it realistic for these changes to be merged? Would any of this interfere with how FB consumes this package? |
I obviously can’t speak for FB, but the order of things makes sense to me 👍 Changing to ESM would also eliminate the one runtime addition that my language plugin PR adds. Might be a good idea to check if the jest-haste package is able to output all the paths of resolved haste modules? |
@robrichard the first 2 steps sound right. In fact, I think I already completed number 1. 2 makes sense to me and would allow us to clean that ugly transform rewriting requires. Would be an annoying, but not terrible breaking change for folks directly requireing the deeper modules, but seems fine. 3 we cannot do yet as we have an environment that only consumes requires and we use the Relay master verbatim there. What we could do is adopt Rollup first (there's some plugin to consume Hope that makes sense! |
@ruslanvs please stop adding these comments |
s |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Are there plans to use rollup and generate flat bundles for Relay (similar to what react did in facebook/react#9327)? It would be nice to get smaller bundles and it looks like this would also address the performance regression in server side rendering (#1321).
Is this something that could be accepted as a pull request without access to internal FB infrastructure?
The text was updated successfully, but these errors were encountered: