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

Avoid webpack to insert setImmediate #48

Merged
merged 1 commit into from
Oct 26, 2018
Merged

Avoid webpack to insert setImmediate #48

merged 1 commit into from
Oct 26, 2018

Conversation

ai
Copy link
Contributor

@ai ai commented Oct 26, 2018

Another optimization by Size Limit profiling data.

- Package size: 5.83 KB
+ Package size: 4.41 KB

Webpack inserts setImmediate polyfill (most of your users will use webpack). And setImmediate brings process polyfill. But there is no need in setImmediate polyfill here.

uykxyyj

This trick will hide setImmediate from Webpack and save 1 KB gzipped JS for your users.

@ai ai mentioned this pull request Oct 26, 2018
@theKashey
Copy link
Owner

Year, I've tried it. Should be safe, as long this function will be called only on componentDidMount - ie will be ok if window does not exists in server env.
(just remembering your PR to remove document access for Jest)

@theKashey theKashey merged commit 9f3711e into theKashey:master Oct 26, 2018
@theKashey
Copy link
Owner

4.41kb confirmed.

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.

None yet

2 participants