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

Rx.umd.js vs Rx.js vs AMD #1678

Closed
benlesh opened this issue May 2, 2016 · 5 comments · Fixed by #1871
Closed

Rx.umd.js vs Rx.js vs AMD #1678

benlesh opened this issue May 2, 2016 · 5 comments · Fixed by #1871
Assignees

Comments

@benlesh
Copy link
Member

benlesh commented May 2, 2016

When we first got the "global build" working a while ago, @jeffbcross and @robwormald took the job. The outcome is that we have an Rx.js and Rx.umd.js file (plus minified counterparts).

  1. I think that Rx.umd.js should just be Rx.js and the other version probably shouldn't exist. I'd like clarification on this separation from @jeffbcross or @robwormald
  2. If we're exporting a UMD version of the library, is there any merit to continuing to publish every module in AMD format? Can't most AMD users just use the UMD one? Are there bundling benefits available in AMD (cc @jayphelps)

Proposal

  • Remove current Rx.js global build output.
  • Rename Rx.umd.js global build output to Rx.js
  • Possibly stop publishing AMD build in favor of guidance to just use UMD global output.

Thoughts?

@jayphelps
Copy link
Member

Publishing each module separately as AMD allows them to import only what they need, but honestly I question whether anyone really is (or will be) doing this. Nearly all AMD-supported modules are shipped as bundled UMD style these days. As far as globals vs AMD, again I'm not aware of any notable difference between just using the UMD. So 👍 from me unless jeff and rob know something we're missing.

@zertosh
Copy link
Contributor

zertosh commented May 8, 2016

I'd like to chime in on this issue and the not so unrelated #1650.

Over at https://github.com/facebook/nuclide we use Rx extensively. Nuclide is not a "web app" and doesn't have any kind of bundling. Our target environments are Atom (Electron) and Node. Currently we require('rxjs'), and separately require a few "kitchen" operators (ex1, ex2).

The perf considerations when requiring Rx change when you're no longer concerned about file size as much as you're concerned about the number of files. Startup speed is critical for us, not just on the Atom clients, but also the server (each client spins up a server process). After measuring, it turned out that it was much faster to require the full kitchen sink UMD build, than to load the non-kitchen sink version piecemeal.

Since Atom already ships with built-in transpiling, the ecosystem has largely evolved without using/needing bundling. When I saw #1650, I was delighted because it means that we can eventually switch to using the bundled version without the burden of a bundling step (or shipping a custom build of Rx).

So back to the original issue. I doubt that anyone still using AMD modules is also using Rx. However, if someone is using require.js, with a little configuration they can interop with CommonJS – or no configuration at all if they use the bundled UMD version.

What may be worth exploring, and I'm clearly biased, is friendlier ways to expose the UMD version. Like maybe making it reachable from the package root instead of the bundles directory (e.g. require('rxjs/Rx.umd.min')). Also, maybe using all lowercase filenames for the bundled version – you don't know on a Mac that you required the wrong thing until your users on Linux tell you.

Just some thoughts.

PS: Looking forward to a beta8 or stable release with "Rx exports all" so we can switch to it in prod.

@benlesh
Copy link
Member Author

benlesh commented May 12, 2016

@zertosh thanks for all of that input. Can I summarize that as "Pro just umd output one file"?

@zertosh
Copy link
Contributor

zertosh commented May 12, 2016

@Blesh yup!

@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants