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

Explore using Rollup for UMD builds #928

Closed
3 tasks
gaearon opened this issue Oct 21, 2015 · 19 comments
Closed
3 tasks

Explore using Rollup for UMD builds #928

gaearon opened this issue Oct 21, 2015 · 19 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Oct 21, 2015

Our compiled code isn't looking nice because of all the junk code generated by Babel for ES6 modules:
https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.3/redux.js

While this is not technically an issue, it would be nice to get a neater compiled output.
Maybe we can explore using Rollup for this.

  • Turn off ES6 module transformation in Babel
  • Try to make both CJS (./lib/) and UMD (./dist/) builds with Rollup instead
  • Of course Babel should still be turned on for the actual transpiling

If somebody wants to explore this feel free to.

@phated
Copy link

phated commented Oct 22, 2015

👎

@gaearon
Copy link
Contributor Author

gaearon commented Oct 22, 2015

More details on 👎 ?

@phated
Copy link

phated commented Oct 22, 2015

[sentence redacted by @gaearon] By moving away from webpack, the community splinters again instead of empowering them to help get webpack 2 out. Jumping ship every few months doesn't enforce the perception of stability in the library.

@Rich-Harris
Copy link

@phated Feel free to @ me in your personal attacks. Surely we should be discussing the technical merit of the two approaches?

@phated
Copy link

phated commented Oct 22, 2015

@Rich-Harris @gaearon posted on twitter about a cool new thing in webpack, you jumped in pushing your own stuff. According to https://github.com/webpack/webpack/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+rich-harris+ - you've never once contributed to the project. Technology isn't the only thing that matters, as a whole community has built up around React/Rackt/Redux. I've said my peace and have no more time to argue with you.

@gaearon
Copy link
Contributor Author

gaearon commented Oct 22, 2015

Different approaches have different merits. Some new approaches may be difficult to implement on top of an existing project, but easier to implement from the ground up. By the same argument, Redux shouldn't have been made, and Flux should have been improved instead. Whether something is different enough that it “deserves” to be a separate thing over splitting a community is always a subjective question, and especially so when the project is young.

Regardless of this, personal attacks are not allowed here. I redacted the part of @phated's comment that contained a personal attack, and we won't tolerate more of them. Even the community discussions can be respectful and polite, no need for extra emotions.

@reduxjs reduxjs locked and limited conversation to collaborators Oct 22, 2015
@gaearon
Copy link
Contributor Author

gaearon commented Oct 22, 2015

I'll lock this thread for a couple of days for emotions to cool down, but I'm still interested in experiments with this. Nobody proposes to “jump the ship”—we're talking about a specific task (producing a readable ES5 output) that neither Webpack nor Babel currently handle well.

@jdalton
Copy link
Contributor

jdalton commented Nov 3, 2015

One of the things I dig about webpack is its new webpack.NormalModuleReplacementPlugin to create smaller builds by swapping out deps like baseIteratee with toFunction.

I'm adding support in lodash-es for simplfied requiring via:

import {chunk, zipObject} from 'lodash-es'

which would only require chunk and zipObject without having to worry about long form paths, like lodash-es/array/chunk or lodash-es/array/zipObject but without dep swapping it really limits amount I can reduce a build.

I think webpack 2 will have tree shaking as well so it's something to consider.

@gaearon
Copy link
Contributor Author

gaearon commented Nov 3, 2015

Yep, I'm also interested in trying Webpack 2 separately.
Ideally I'd like a Rollup-like plugin for Webpack :-P

@Rich-Harris
Copy link

Ideally I'd like a Rollup-like plugin for Webpack :-P

I get that a lot 😀 I wrote down a few notes on why Rollup is a separate project: rollup/rollup#219 (comment)

@taion
Copy link
Contributor

taion commented Nov 16, 2015

From the sidelines -

Regarding the points above, Rollup doesn't seem like it'd be helpful for making a CJS module build, since it's just a bundler. It's worth considering making a separate ES6 module build, though, since they're rather nicer to work with (matters more for larger libraries).

Practically I think it'd be best to wait until webpack 2 is released before choosing between webpack and rollup. I'm very happy with the current "everybody uses webpack" equilibrium in the React community, because it makes it easy to understand the build pipeline on a variety of different projects quickly. It'd be a shame to give that up.

@raphaelokon
Copy link

@gaearon Are there any plans to make redux work with rollup?

@taion
Copy link
Contributor

taion commented Jul 13, 2016

Redux works fine with Rollup for users. It even exports a fully ES-module-ified build. This issue is about building the Redux distributable JS bundles with Rollup instead of with webpack.

@raphaelokon
Copy link

Sorry, I had this issue with redux using rollup … and thought it was related. Thanks for clarifying @taion

@timdorr timdorr closed this as completed Jul 31, 2016
@taion
Copy link
Contributor

taion commented Jul 31, 2016

@timdorr What's the resolution here? Is the thought that the benefits of Rollup are not worth the cost of adding more tooling for now?

@timdorr
Copy link
Member

timdorr commented Jul 31, 2016

Yeah, that's basically it. Nothing is really happening here too, so it seems like there isn't much interest in this right now. It's basically a bunch of bikeshedding to save a few bytes and make our UMD builds a little more pretty (which doesn't matter because it all gets ugly when you uglify it).

@taion
Copy link
Contributor

taion commented Jul 31, 2016

That makes sense. For future clarity, if someone were to contribute a PR to add this, would you expect to reject that PR?

@timdorr
Copy link
Member

timdorr commented Jul 31, 2016

Not necessarily. I'm not ruling it out completely. But webpack is 4-5x as popular as Rollup, so we would want to make sure we're not black boxing our build toolchain for a significant number of users such that future updates don't have a cheerleader and we don't start closing things with "Well, I don't know why it works, but it works!"

@raphaelokon
Copy link

@timdorr Everything is working so far for me with Rollup (after they patched their plugin I ref'd here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants