Skip to content

Commit 75f77ee

Browse files
committed
Implement sass --embedded in pure JS mode
1 parent 6d60eea commit 75f77ee

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Diff for: lib/src/compiler-path.ts

+16-3
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ export const compilerCommand = (() => {
5353
`sass-embedded-${platform}-${arch}/dart-sass/src/sass.snapshot`
5454
),
5555
];
56-
} catch (ignored) {
57-
// ignored
56+
} catch (e) {
57+
if (!(isErrnoException(e) && e.code === 'MODULE_NOT_FOUND')) {
58+
throw e;
59+
}
5860
}
5961

6062
try {
@@ -70,10 +72,21 @@ export const compilerCommand = (() => {
7072
}
7173
}
7274

75+
try {
76+
return [
77+
process.execPath,
78+
p.join(p.dirname(require.resolve('sass')), 'sass.js'),
79+
];
80+
} catch (e: unknown) {
81+
if (!(isErrnoException(e) && e.code === 'MODULE_NOT_FOUND')) {
82+
throw e;
83+
}
84+
}
85+
7386
throw new Error(
7487
"Embedded Dart Sass couldn't find the embedded compiler executable. " +
7588
'Please make sure the optional dependency ' +
76-
`sass-embedded-${platform}-${arch} is installed in ` +
89+
`sass-embedded-${platform}-${arch} or sass is installed in ` +
7790
'node_modules.'
7891
);
7992
})();

0 commit comments

Comments
 (0)