-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Webpack-bundled output duplicates history/es/* and history/* imports #5576
Comments
Possibly related to #5095. |
As far as I can tell, import { createLocation, locationsAreEqual } from 'history'; Since The second is import createHistory from 'history/createMemoryHistory'; According to the modules proposal, I think the most obvious solution here would be a PR to a resolve: {
alias: {
'history/createMemoryHistory':
path.resolve(__dirname, 'node_modules/history/es/createMemoryHistory'),
'history/createHashHistory':
path.resolve(__dirname, 'node_modules/history/es/createHashHistory'),
'history/createBrowserHistory':
path.resolve(__dirname, 'node_modules/history/es/createBrowserHistory'),
'history/PathUtils':
path.resolve(__dirname, 'node_modules/history/es/PathUtils')
}
} |
I see the fix was merged 3 months ago; when can we expect a new version with this fix to be published? |
I am having sort of the flip-side to this issue. It seems React Router wants to import from |
👍 to a new release |
…n#5589) * Use named import of 'history' module. * Coding style fixes.
Version
4.2.0 (w/ webpack 3.6.0)
Test Case
https://github.com/mattdistefano/react-router-repro
Steps to reproduce
See repo above - very basic webpack config, but compiled output in
dist/index.js
duplicates much of the history package (search forvar createBrowserHistory
to confirm) by including both the esm files fromnode_modules/history/es
and CJS equivalents fromnode_modules/history
.It seems like the deep-import react-router does from history -
import createHistory from 'history/createBrowserHistory';
- causes webpack to dup the imported code. Doing a named import instead -import { createBrowserHistory as createHistory } from 'history';
- seems to work better (though it looks like history doesn't re-export everything RR needs ATM).I'm not sure if this is a webpack bug or an RR but figured I'd log it here first.
Expected Behavior
Should get just the ESM files in the bundle.
Actual Behavior
See above.
The text was updated successfully, but these errors were encountered: