Skip to content

fix: bundle CSS from external dependencies instead of externalizing#981

Open
compass-vin wants to merge 1 commit into
rolldown:mainfrom
compass-vin:fix-external-css
Open

fix: bundle CSS from external dependencies instead of externalizing#981
compass-vin wants to merge 1 commit into
rolldown:mainfrom
compass-vin:fix-external-css

Conversation

@compass-vin

Copy link
Copy Markdown

Summary

Fixes #959

CSS files imported via JS/TS from production dependencies (listed in dependencies, peerDependencies, or optionalDependencies) were being marked as external by the deps plugin, which prevented the CSS plugin from processing them into the output bundle.

This affected both regular CSS imports and ?inline CSS imports:

  • import 'jodit/es2021/jodit.css' — CSS not included in output style.css
  • import style from 'jodit/es2021/jodit.css?inline' — CSS not inlined as string

Root cause: externalStrategy() in src/features/deps.ts checked if an import's package name matched a production dependency and externalized it unconditionally. CSS files need to be bundled so the CSS plugin can process them.

Fix: Added a guard in externalStrategy() that returns 'no-external' for CSS file imports (.css, .scss, .sass, .less, .styl, .stylus), stripping any query string (e.g. ?inline) before testing. This runs after the alwaysBundle check but before the dependency externalization checks.

Test plan

  • Added test: external dependency CSS is bundled via JS import
  • Added test: external dependency CSS is bundled via JS ?inline import
  • All existing CSS tests pass (100 passed + 3 expected fail)
  • All existing deps tests pass (15 passed)

🤖 Generated with Claude Code

CSS files imported via JS/TS (e.g. `import 'pkg/style.css'` or
`import style from 'pkg/style.css?inline'`) from production dependencies
were being marked as external by the deps plugin, preventing the CSS
plugin from processing them into the output bundle.

Fixes rolldown#959

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 20, 2026

Copy link
Copy Markdown

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 59da85c
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/6a36eff84658ba0008fa283f
😎 Deploy Preview https://deploy-preview-981--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 Jun 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: 59da85c

@compass-vin

Copy link
Copy Markdown
Author

@compass-vin compass-vin marked this pull request as ready for review June 20, 2026 20:11
@compass-vin

Copy link
Copy Markdown
Author

@sxzz Hey, it's my first time contributing to this project so apologies if I'm missing a step. Is there anything I need to do to get this reviewed?

Thanks for all the work on this btw, I love this library.

@compass-vin compass-vin marked this pull request as draft June 24, 2026 02:28
@compass-vin compass-vin marked this pull request as ready for review June 24, 2026 02:28
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.

External CSS assets not being inlined when imported via ?inline

1 participant