Skip to content

Commit 37ddc09

Browse files
committed
Prefer a local development compiler to an installed dependency
1 parent fec6ff6 commit 37ddc09

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/src/compiler-path.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ import {isErrnoException} from './utils';
88

99
/** The path to the embedded compiler executable. */
1010
export const compilerPath = (() => {
11-
try {
12-
return require.resolve(
13-
`sass-embedded-${process.platform}-${process.arch}/` +
14-
'dart-sass-embedded/dart-sass-embedded' +
15-
(process.platform === 'win32' ? '.bat' : '')
16-
);
17-
} catch (e: unknown) {
18-
if (!(isErrnoException(e) && e.code === 'MODULE_NOT_FOUND')) {
19-
throw e;
20-
}
21-
}
22-
2311
// find for development
2412
for (const path of ['vendor', '../../../lib/src/vendor']) {
2513
const executable = p.resolve(
@@ -33,6 +21,18 @@ export const compilerPath = (() => {
3321
if (fs.existsSync(executable)) return executable;
3422
}
3523

24+
try {
25+
return require.resolve(
26+
`sass-embedded-${process.platform}-${process.arch}/` +
27+
'dart-sass-embedded/dart-sass-embedded' +
28+
(process.platform === 'win32' ? '.bat' : '')
29+
);
30+
} catch (e: unknown) {
31+
if (!(isErrnoException(e) && e.code === 'MODULE_NOT_FOUND')) {
32+
throw e;
33+
}
34+
}
35+
3636
throw new Error(
3737
"Embedded Dart Sass couldn't find the embedded compiler executable. " +
3838
'Please make sure the optional dependency ' +

0 commit comments

Comments
 (0)