Skip to content

perf: drop IE11 support, reduce bundle by 4.3% - #5698

Merged
quantizor merged 6 commits into
mainfrom
chore/drop-ie11-bundle-savings
Mar 21, 2026
Merged

quantizor merged 6 commits into
mainfrom
chore/drop-ie11-bundle-savings

Conversation

@quantizor

@quantizor quantizor commented Mar 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Bump TS target from ES5 to ES2015 and terser ecma to 2015 (eliminates __assign/__spreadArray polyfills, .concat() template literal chains)
  • Compress domElements tag set into a single-line array (vs 155 individually quoted strings)
  • Inline @emotion/unitless with 10 IE-only entries removed (boxFlex, boxFlexGroup, boxOrdinalGroup, flexPositive, flexNegative, flexOrder, msGridRow, msGridRowSpan, msGridColumn, msGridColumnSpan)
  • Simplify DISABLE_SPEEDY env var detection (extract helper, deduplicate typeof process 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, -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.

- 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-bot

changeset-bot Bot commented Mar 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 970f13a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
styled-components Minor

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.for is 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.

@quantizor
quantizor merged commit 2a973d8 into main Mar 21, 2026
4 checks passed
@quantizor
quantizor deleted the chore/drop-ie11-bundle-savings branch March 21, 2026 15:10
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.

2 participants