Skip to content

fix(css): don't override internal importer#860

Merged
sxzz merged 1 commit intorolldown:mainfrom
Laupetin:fix-custom-sass-importer
Mar 25, 2026
Merged

fix(css): don't override internal importer#860
sxzz merged 1 commit intorolldown:mainfrom
Laupetin:fix-custom-sass-importer

Conversation

@Laupetin
Copy link
Contributor

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

Description

This PR fixes the fact, that user specified importers for sass via preprocessorOptions override the default importer from tsdown.
This breaks e.g. importing from node_modules.

For details and reproduction link, see the corresponding issue: #859

Linked Issues

Fixes: #859

Additional context

I fixed the issue by doing the minimal changes, keeping user values overriding all values expect for the special case handling of the importers array.

If user values overriding the other values would also be considered unintended behaviour, the object spread for the user values could be moved up even further:

  const result = await sass.compileStringAsync(data, {
    ...sassOptions,
    url: pathToFileURL(filename),
    sourceMap: false,
    syntax: lang === 'sass' ? 'indented' : 'scss',
    importers: [internalImporter, ...(sassOptions.importers ?? [])],
  })

if you wanna change it to that, let me know (or feel free to edit yourself, if you prefer).

@netlify
Copy link

netlify bot commented Mar 24, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 8ccf5db
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69c259b6b6f9580008ada222
😎 Deploy Preview https://deploy-preview-860--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 24, 2026

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: 8ccf5db

Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

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

Thanks!

@sxzz sxzz changed the title fix(css): user sass importers override internalImporter fix(css): don't override internal importer Mar 25, 2026
@sxzz sxzz merged commit af40e43 into rolldown:main Mar 25, 2026
14 checks passed
@Laupetin Laupetin deleted the fix-custom-sass-importer branch March 25, 2026 06:20
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.

Specifying custom SCSS importer overrides default importer

2 participants