Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(css): fix directory index import in sass modern api #17960

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: skip fixScssBugImportValue for sass-embedded
  • Loading branch information
hi-ogawa committed Aug 28, 2024
commit c40fb9b0fd0a7ba5c8d319b444e6379dc2cf1fb3
11 changes: 10 additions & 1 deletion packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,7 @@ const makeScssWorker = (
resolvers: CSSAtImportResolvers,
alias: Alias[],
maxWorkers: number | undefined,
packageName: 'sass' | 'sass-embedded',
) => {
const internalImporter = async (
url: string,
Expand All @@ -2116,6 +2117,9 @@ const makeScssWorker = (
'$',
resolvers.sass,
)
if (packageName === 'sass-embedded') {
return data
}
return fixScssBugImportValue(data)
} catch (data) {
return data
Expand Down Expand Up @@ -2408,7 +2412,12 @@ const scssProcessor = (
? makeModernCompilerScssWorker(resolvers, options.alias, maxWorkers)
: api === 'modern'
? makeModernScssWorker(resolvers, options.alias, maxWorkers)
: makeScssWorker(resolvers, options.alias, maxWorkers),
: makeScssWorker(
resolvers,
options.alias,
maxWorkers,
sassPackage.name,
),
)
}
const worker = workerMap.get(options.alias)!
Expand Down