Switch build to Rollup?
See original GitHub issueI just wanted to bring this up since there is some discussion happening related to the current builds (#5095).
I’ve been using Rollup in some of my projects to output a single file for each format and enjoying it. For React Router, that would mean that instead of a dozen commonjs files, a dozen es files, and two UMD files, we would end up with four total files (react-router.common.js, react-router.es.js, react-router.js, and react-router.min.js) . I think that that is the direction Facebook is heading with React and I know that that is what Vue is already doing.
The only real “concern” I’ve had with that is source maps. Rollup can generate them for you, that isn’t the problem. It is just that I end up having to use the source-map-loader to prevent the browser for asking for them. It is just a minor annoyance, but something to take into consideration. Vue doesn’t even ship with sourcemap files, although I’m not sure what the reasoning behind that is.
Another thing to think about is that only the top level exports get exported. Whether or not this is a good thing probably depends on who you ask. I like it because you don’t have to worry about people importing private APIs from the package. If it isn’t exported from index.js, they can’t import it. I suppose that technically that is a breaking change for people who do import Route from 'react-router/Route'. It doesn’t break the API, though, so I think that a minor bump would be enough.
If there is interest, I can put together a PR to do this. I might go ahead and actually do that anyways to get an idea of the output file sizes.
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (21 by maintainers)

Top Related StackOverflow Question
Ideally
prop-typeswould be external, but I think that it should probably be bundled. Even if a user is stripping all of their prop types in production, we rely on them forcontext. Its a little bump to the file size, but a lot more convenient for developers. Even more convenient was when React provided them, but c’est la vie.I should probably switch
react-router-configto rollup first.