Repository navigation
perf: drop IE11 support, reduce bundle by 4.3% - #5698
Merged
Merged
Conversation
- Bump TS target from ES5 to ES2015, terser ecma to 2015 (eliminates __assign/__spreadArray polyfills, .concat() chains) - Compress domElements tag set (single-line array vs 155 individual strings) - Inline @emotion/unitless with IE-only entries removed (boxFlex, boxFlexGroup, boxOrdinalGroup, flexPositive, flexNegative, flexOrder, msGridRow, msGridRowSpan, msGridColumn, msGridColumnSpan) - Simplify DISABLE_SPEEDY env var detection (extract helper, dedupe guards) - Remove legacy React class statics from hoist (childContextTypes, contextTypes, mixins, getDefaultProps) - Remove hasSymbol guard (Symbol.for guaranteed in ES2015+) Bundle: 12.8kB → 12.25kB gzip (-550 bytes)
🦋 Changeset detectedLatest commit: 970f13a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull request overview
Updates the styled-components package build/tooling to drop IE11-era constraints and reduce emitted bundle size by targeting ES2015+, removing legacy guards/polyfills, and inlining data previously sourced from dependencies.
Changes:
- Raise TS emit target to ES2015 and align terser output to
ecma: 2015. - Inline and trim data tables (unitless CSS properties; DOM element tag set) to reduce bundle weight.
- Simplify runtime checks (speedy flag detection; hoist statics assumptions now that
Symbol.foris guaranteed).
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Removes @emotion/unitless from the workspace importer dependencies and updates lock snapshots accordingly. |
| packages/styled-components/tsconfig.json | Bumps TypeScript compilation target from ES5 → ES2015 and drops ES5-only iteration setting. |
| packages/styled-components/src/utils/hoist.ts | Removes hasSymbol fallback, trims legacy React statics handling, and tightens typing around $$typeof. |
| packages/styled-components/src/utils/domElements.ts | Compresses the tag list into a single-line as const array (prettier-ignored). |
| packages/styled-components/src/utils/addUnitIfNeeded.ts | Inlines the unitless-property map (removing IE-only entries) instead of importing from @emotion/unitless. |
| packages/styled-components/src/constants.ts | Extracts DISABLE_SPEEDY env parsing into a helper to dedupe guards. |
| packages/styled-components/rollup.config.mjs | Sets terser ecma to 2015 to allow smaller/minimal modern output. |
| packages/styled-components/package.json | Bumps package version, removes @emotion/unitless dependency, and updates bundlewatch size threshold. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__assign/__spreadArraypolyfills,.concat()template literal chains)domElementstag set into a single-line array (vs 155 individually quoted strings)@emotion/unitlesswith 10 IE-only entries removed (boxFlex,boxFlexGroup,boxOrdinalGroup,flexPositive,flexNegative,flexOrder,msGridRow,msGridRowSpan,msGridColumn,msGridColumnSpan)DISABLE_SPEEDYenv var detection (extract helper, deduplicatetypeof processguards)childContextTypes,contextTypes,mixins,getDefaultProps)hasSymbolguard (Symbol.forguaranteed in ES2015+)Bundle: 12.8kB → 12.25kB gzip (-550 bytes, -4.3%)
IE11 is at 0.01% global usage (StatCounter, March 2026). Microsoft permanently disabled it in February 2023. React 18 (our minimum) dropped IE11 in 2022. styled-components v6 already requires React 18+, so IE11 support was already impossible in practice.