Skip to content

Commit cb55b24

Browse files
Harden Sass fallback when sass-embedded unavailable
If both 'sass-embedded' and 'sass' fail to load, fail fast with a clear error message instead of surfacing an opaque dynamic import error. Keeps build failures actionable in misconfigured environments.
1 parent 38a4f9a commit cb55b24

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

build.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@ async function runWebpack(isWithoutKatex, isWithoutTiktoken, minimal, sourceBuil
9898
try {
9999
const mod = await import('sass-embedded')
100100
sassImpl = mod.default || mod
101-
} catch (e) {
102-
const mod = await import('sass')
103-
sassImpl = mod.default || mod
101+
} catch (e1) {
102+
try {
103+
const mod = await import('sass')
104+
sassImpl = mod.default || mod
105+
} catch (e2) {
106+
throw new Error(`No Sass implementation available. Install 'sass-embedded' or 'sass'.`)
107+
}
104108
}
105109

106110
const dirKey = path.basename(sourceBuildDir || outdir)

0 commit comments

Comments
 (0)