Skip to content
Merged
Changes from all commits
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
10 changes: 8 additions & 2 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,22 @@ const resolveSymlinks = getBooleanEnv(process.env.BUILD_RESOLVE_SYMLINKS, false)

// Cache and resolve Sass implementation once per process
let sassImplPromise
function resolveSassImplementation(mod) {
if (mod && typeof mod.info === 'string') return mod
if (mod?.default && typeof mod.default.info === 'string') return mod.default
return mod
}

async function getSassImplementation() {
if (!sassImplPromise) {
sassImplPromise = (async () => {
try {
const mod = await import('sass-embedded')
return mod.default || mod
return resolveSassImplementation(mod)
} catch (e1) {
try {
const mod = await import('sass')
return mod.default || mod
return resolveSassImplementation(mod)
} catch (e2) {
console.error('[build] Failed to load sass-embedded:', e1)
console.error('[build] Failed to load sass:', e2)
Expand Down