question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Switch build to Rollup?

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
pshrmncommented, Jul 15, 2017

Ideally prop-types would 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 for context. 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.

1reaction
pshrmncommented, Jul 15, 2017

I should probably switch react-router-config to rollup first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rollup.js
To build different bundles with the same input, you supply an array of output options for each input: // rollup.config.js (building more than...
Read more >
Converting a Webpack Build to Rollup - Ship Shape
We'll go through each conversion, step by step here, in the hopes that it will be helpful to others who may want to...
Read more >
How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
Step 1: Install Rollup and create a configuration file. ... Next, create a new file called rollup.config.js in the learn-rollup folder. Inside, add...
Read more >
Switch Rollup from Webpack - Medium
Like Webpack , Rollup is a bundler that makes modules (files) of large and complicated code small as a library or application ....
Read more >
Switch build to Rollup? · Issue #5336 · remix-run/react-router
I've been using Rollup in some of my projects to output a single file for each format and enjoying it. For React Router,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found