Skip to content

fix(css): remove dangling requires for pure CSS chunks - #1077

Closed
dexhunter wants to merge 2 commits into
rolldown:mainfrom
dexhunter:fix/cjs-css-chunk-imports
Closed

dexhunter wants to merge 2 commits into
rolldown:mainfrom
dexhunter:fix/cjs-css-chunk-imports

Conversation

@dexhunter

@dexhunter dexhunter commented Sep 15, 2026 •

Copy link
Copy Markdown

AI usage

  • No AI was used in this PR.
  • AI was used: Codex + GPT-6 Astra and GPT-5.6 Luna.
    • I have carefully reviewed the AI-generated content myself.

Description

Remove side-effect CommonJS require calls that point to deleted pure CSS chunks so unbundled entries importing CSS can be loaded. Add coverage for minified output, short paths, and unrelated calls that must remain unchanged.

Linked Issues

Fixes #1075, Fixes #912

Additional context

CSS, unbundle, and helper tests: 119 passed, 3 expected failures. Lint and typecheck passed.

Baseline and candidate checks on Weco (retrospective record).

Copilot AI lite review requested due to automatic review settings September 15, 2026 18:15
@netlify

netlify Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 089824a
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/6ae34d39e8290b4f3dc6f4a8
😎 Deploy Preview https://deploy-preview-1077--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

tsdown

pnpm add https://pkg.pr.new/rolldown/tsdown@1077 -D
npm i https://pkg.pr.new/rolldown/tsdown@1077 -D
yarn add https://pkg.pr.new/rolldown/tsdown@1077.tgz -D

create-tsdown

pnpm add https://pkg.pr.new/rolldown/tsdown/create-tsdown@1077 -D
npm i https://pkg.pr.new/rolldown/tsdown/create-tsdown@1077 -D
yarn add https://pkg.pr.new/rolldown/tsdown/create-tsdown@1077.tgz -D

@tsdown/css

pnpm add https://pkg.pr.new/rolldown/tsdown/@tsdown/css@1077 -D
npm i https://pkg.pr.new/rolldown/tsdown/@tsdown/css@1077 -D
yarn add https://pkg.pr.new/rolldown/tsdown/@tsdown/css@1077.tgz -D

@tsdown/exe

pnpm add https://pkg.pr.new/rolldown/tsdown/@tsdown/exe@1077 -D
npm i https://pkg.pr.new/rolldown/tsdown/@tsdown/exe@1077 -D
yarn add https://pkg.pr.new/rolldown/tsdown/@tsdown/exe@1077.tgz -D

tsdown-migrate

pnpm add https://pkg.pr.new/rolldown/tsdown/tsdown-migrate@1077 -D
npm i https://pkg.pr.new/rolldown/tsdown/tsdown-migrate@1077 -D
yarn add https://pkg.pr.new/rolldown/tsdown/tsdown-migrate@1077.tgz -D

commit: 089824a

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved review comments remain, and the changes include targeted regression coverage.

Pull request overview

Fixes dangling CommonJS require calls left by removed pure CSS chunks.

Changes:

  • Adds path-aware AST replacement for CSS requires.
  • Preserves unrelated requires and source offsets.
  • Expands unit and integration coverage, including minified output.
File summaries
File Description
tests/utils.ts Adds output inspection and runtime helpers.
tests/css.test.ts Adds CSS and unbundle integration coverage.
packages/css/src/pure-chunk.ts Removes dangling CSS imports and requires.
packages/css/src/pure-chunk.test.ts Tests replacement behavior and edge cases.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Keep the upstream lint directive and the CJS runtime helper import when merging main into the CSS fix branch.

Fixes rolldown#1075
@dexhunter

Copy link
Copy Markdown
Author

Merged main at 83b6fb5 in commit 089824a and resolved the test helper conflict. Both the lint directive and CJS helper import remain.

pnpm test run packages/css/src/pure-chunk.test.ts tests/css.test.ts tests/unbundle.test.ts passed: 120 tests, with 3 expected failures. pnpm lint and pnpm typecheck also passed.

Four CSS regression cases fail with upstream's chunk removal code. All six selected cases pass with this fix.

AI-assisted: Codex prepared this merge and ran the checks.

@sxzzbot

sxzzbot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #1114, which was merged. It removes the require() with the same regex-based approach Vite uses, instead of AST parsing, to match how the ESM imports are already handled. The Card2 name is fixed separately in Rolldown (rolldown/rolldown#11410).

@sxzz sxzz closed this Nov 2, 2026
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.

unbundle, cjs with css and same name files results in missing cjs file Invisible name clash when importing a css file in same-named JS file

4 participants