Repository navigation
Description
Summary
[email protected] ships a bare top-level process; statement in the browser bundles. Evaluating that identifier in a browser environment (no Node process global) throws:
ReferenceError: process is not defined
This does not appear in the previous prerelease 6.6.0-prerelease-20260905051044.
Affected artifacts
| File | bare process; |
|---|---|
dist/styled-components.browser.esm.js |
1 (new) |
dist/styled-components.browser.cjs.js |
1 (new) |
dist/styled-components.esm.js / .cjs.js / .js / .min.js |
0 |
Snippet from styled-components.browser.esm.js (minified):
...}),g}process;var ut=new Set(["a","abbr","address",...Likely origin
Introduced with the RSC / Suspense style-emission fix:
- Commit: 1c0e309
- PR: inline <style> tags get removed by <Suspense> streaming, making styles disappear #5808
Source looks consistent with a module-level process.env.NODE_ENV !== 'production' ? … : null in packages/styled-components/src/models/StyledComponent.ts (e.g. the new createRSCCache(...) path) whose dead-code elimination / browser replace left a residual process; instead of removing the whole statement.
Reproduction
- Install
[email protected]. - Resolve the browser ESM build (
dist/styled-components.browser.esm.js). - Search for a bare
process;(notprocess.env.NODE_ENV, nottypeof process). - Load that module in a browser (or Storybook/Chromatic verify) without a
processpolyfill.
Compare to 6.6.0-prerelease-20260905051044: same browser files have zero bare process;.
Why this bites Storybook / Vite / Chromatic
Many Storybook + Vite setups intentionally do not polyfill process (they only define things like process.env / process.env.NODE_ENV). Vite can replace process.env.NODE_ENV, but it does not rewrite a leftover bare identifier statement process;. Chromatic’s post-upload browser verify then fails with process is not defined even though storybook build itself may succeed.
We hit this in production CI after bumping only this prerelease; unit/Storybook-Vitest jobs stayed green, Chromatic verify failed.
Expected
Browser builds should not contain any free process identifier that must be evaluated at runtime. process.env.NODE_ENV checks should fully DCE / replace in browser bundles (or stay behind typeof process !== 'undefined' guards that never evaluate a bare process statement).
Workaround
Locally we can pnpm patch both browser builds to delete the stray process;, or pin the previous prerelease until a fixed publish lands.
Environment
- Package:
[email protected] - Prior good:
[email protected] - Consumed via Vite 8 + Storybook 10 + Chromatic CLI (browser verify)
Happy to test a canary that drops the bare process; from the browser builds.
Activity
pullfrog commentedon Sep 18, 2026
6.x maintenance: attrs and undefined props, RSC global styles, types …
quantizor commentedon Sep 25, 2026
Please try https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0-prerelease-20260925231434 when you get a moment!
quantizor commentedon Oct 10, 2026
@Stanzilla ping
Stanzilla commentedon Oct 10, 2026
Oh yes, my bad! It works, thank you!
quantizor commentedon Oct 12, 2026
Made some additional improvements, final implementation now out in 6.6, thanks! https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0