Skip to content

browser build of 6.6.0-prerelease-20260908162735 leaves bare process; (breaks Vite/Storybook/Chromatic) #5819

Closed

Description

@Stanzilla

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:

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

  1. Install [email protected].
  2. Resolve the browser ESM build (dist/styled-components.browser.esm.js).
  3. Search for a bare process; (not process.env.NODE_ENV, not typeof process).
  4. Load that module in a browser (or Storybook/Chromatic verify) without a process polyfill.

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

Happy to test a canary that drops the bare process; from the browser builds.

Activity

  1. pullfrog commented on Sep 18, 2026

    @pullfrog
  2. quantizor commented on Oct 10, 2026

    @quantizor
    Contributor
  3. Stanzilla commented on Oct 10, 2026

    @Stanzilla
    Author

    5. @Stanzilla ping

    Oh yes, my bad! It works, thank you!

  4. quantizor commented on Oct 12, 2026

    @quantizor
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions