Skip to content

fix(css): inline ?inline CSS imported from dependencies - #1109

Merged
sxzz merged 1 commit into
mainfrom
fix/css-inline-deps
Oct 28, 2026
Merged

sxzz merged 1 commit into
mainfrom
fix/css-inline-deps

Conversation

@sxzz

@sxzz sxzz commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

AI usage

  • No AI was used in this PR.
  • AI was used: Claude Code + Claude Opus 5.5
    • I have carefully reviewed the AI-generated content myself.

Description

Importing CSS from a dependency with ?inline (e.g. import css from 'jodit/es2021/jodit.css?inline') left the import external instead of embedding the stylesheet as a string. Two things caused it:

  • DepsPlugin externalized it like any other import of a dependency. ?inline CSS is now skipped by the automatic externalization, since it has to be embedded.
  • The CSS plugin stripped the query before this.resolve, so DepsPlugin saw a plain pkg/style.css. It now resolves the full id and normalizes the result to <path>?inline.

Explicit deps.neverBundle patterns still keep the import external.

Linked Issues

Closes #959

Additional context

Since the dependency's CSS is now bundled, projects that set deps.onlyBundle without listing that package will get the "not included in deps.onlyBundle" error for it.

Copilot AI balanced review requested due to automatic review settings October 28, 2026 06:58
@netlify

netlify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit ab9a9e4
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/6ae19d0355adf78e50f8913a
😎 Deploy Preview https://deploy-preview-1109--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 Oct 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: ab9a9e4

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

The dependency stylesheet inlining change has no active review issues.

No open issues 🎉

What changed in this PR

Fixes dependency stylesheet imports using ?inline so tsdown embeds their contents as strings rather than leaving external imports, addressing #959.

Changes:

  • Bypasses automatic externalization for inline CSS while preserving explicit deps.neverBundle patterns.
  • Preserves the query during CSS resolution and normalizes resolved inline IDs.
  • Adds a dependency-import regression test and expected output snapshot.
File Description
tests/​css.test.ts Tests that dependency CSS is embedded without an external import.
tests/​__snapshots__/​css/​handle-css-inline-from-dependencies.snap.md Records the expected embedded stylesheet output.
src/​features/​deps.ts Exempts inline stylesheets from automatic externalization.
packages/​css/​src/​plugin.ts Keeps the query during resolution and normalizes the inline ID.

Review effort: Balanced

@sxzz
sxzz merged commit 75a78ce into main Oct 28, 2026
18 checks passed
@sxzz
sxzz deleted the fix/css-inline-deps branch October 28, 2026 07:07
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

3 participants