Skip to content

fix: resolve css files in node_modules#795

Merged
sxzz merged 12 commits intomainfrom
ocavue/css-import-node-modules
Mar 5, 2026
Merged

fix: resolve css files in node_modules#795
sxzz merged 12 commits intomainfrom
ocavue/css-import-node-modules

Conversation

@ocavue
Copy link
Collaborator

@ocavue ocavue commented Mar 4, 2026

  • This PR contains AI-generated code, but I have carefully reviewed it myself. Otherwise, my PR may be closed.

Description

Closes #794

Linked Issues

Additional context

@netlify
Copy link

netlify bot commented Mar 4, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit a546442
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69a8d8876f5ce7000838be4e
😎 Deploy Preview https://deploy-preview-795--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 4, 2026

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: 3a05faa

@ocavue ocavue marked this pull request as ready for review March 4, 2026 12:20
@ocavue ocavue requested review from Copilot and sxzz March 4, 2026 12:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes CSS @import resolution for LightningCSS when importing styles from packages under node_modules (e.g. @import "pkg/path.css"), addressing issue #794.

Changes:

  • Add module resolution via oxc-resolver for LightningCSS bundling, enabling node_modules import resolution.
  • Extend CSS tests and snapshots to cover @import from a mock package in node_modules for both PostCSS and LightningCSS transformers.
  • Add oxc-resolver to the workspace catalog and @tsdown/css package dependencies.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/css.test.ts Expands @import test coverage to include node_modules-style imports and updates expectations.
tests/snapshots/css/postcss-with-import.snap.md Updates snapshot output to include inlined .lib rules from the imported package CSS.
tests/snapshots/css/lightningcss-transformer-with-import.snap.md Updates snapshot output to include inlined .lib rules for LightningCSS bundling.
pnpm-workspace.yaml Adds oxc-resolver to the pnpm catalog for consistent dependency management.
pnpm-lock.yaml Locks oxc-resolver (and its platform bindings) and updates dependency graph accordingly.
packages/css/src/lightningcss.ts Implements oxc-resolver-based resolution inside LightningCSS bundling to support node_modules CSS imports.
packages/css/package.json Declares oxc-resolver as a dependency of @tsdown/css.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ocavue ocavue force-pushed the ocavue/css-import-node-modules branch from 18889d4 to 03d1c61 Compare March 4, 2026 12:33
@ocavue ocavue changed the title fix: resolve css imports under node_modules fix: resolve css in node_modules Mar 4, 2026
@ocavue ocavue changed the title fix: resolve css in node_modules fix: resolve css files in node_modules Mar 4, 2026
@ocavue
Copy link
Collaborator Author

ocavue commented Mar 5, 2026

@sxzz I've resolved the merge conflict.

@sxzz sxzz merged commit d8a1f5c into main Mar 5, 2026
15 checks passed
@sxzz sxzz deleted the ocavue/css-import-node-modules branch March 5, 2026 03:57
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.

Cannot @import css files under node_modules

4 participants