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

Redundant imports from history bloating bundle sizes #5971

Closed
DullReferenceException opened this issue Feb 26, 2018 · 1 comment
Closed

Redundant imports from history bloating bundle sizes #5971

DullReferenceException opened this issue Feb 26, 2018 · 1 comment

Comments

@DullReferenceException
Copy link

Version

react-router-dom@4.2.2

Steps to reproduce

Create a webpack bundle that import react-router-dom

Expected Behavior

Only the main or es folder of the history library is bundled

Actual Behavior

Both the main and es folder of the history library is bundled

Theory

I believe that the issue stems from the fact that there are two different ways that things are being imported from history:

  • Deep imports like require('history/createBrowserHistory')
  • Direct imports like require('history')

The former type of import is bringing in JS modules in the root of node_modules/history, but the latter type is causing node_modules/es/index.js and its dependencies to be brought in due to the "main" entry point in its package.json.

In theory changing the imports to be consistent will avoid bundling all the files in both node_modules/history and node_modules/history/es.

@pshrmn
Copy link
Contributor

pshrmn commented Feb 26, 2018

This is a duplicate of #5576, which was fixed with #5589 but is not yet released.

@pshrmn pshrmn closed this as completed Feb 26, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 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

No branches or pull requests

2 participants