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

fix: import history from ESM #934

Merged
merged 1 commit into from
Feb 4, 2022
Merged

fix: import history from ESM #934

merged 1 commit into from
Feb 4, 2022

Conversation

ryanflorence
Copy link
Member

Removing closure compiiler fixes the problem. The build is now much faster and the resulting file size difference is marginal.

The UMD production file size went from 6,105 bytes with closure compiler to 6,164 without it. We can afford 59 bytes to get ESM support.

@ryanflorence
Copy link
Member Author

ryanflorence commented Feb 4, 2022

I verified manually with this:

npm run build
mkdir ~/Desktop/test
touch ~/Desktop/test/go.mjs
cp -R build ~/Desktop/test/node_modules

Then running this script works as expected:

import { createMemoryHistory } from 'history';
console.log(createMemoryHistory);

Removing closure compiiler fixes the problem. The build is now much faster and the resulting file size difference is marginal.
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mjackson mjackson merged commit ba1cd3c into dev Feb 4, 2022
@mjackson mjackson deleted the ryan/esm branch February 4, 2022 19:39
@kristoferbaxter
Copy link
Contributor

kristoferbaxter commented Feb 4, 2022

Seems like a smart tradeoff to me as well.

Does this mean the dependency can also be removed in package.json? I didn't see another usage.

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

Successfully merging this pull request may close these issues.

5 participants