Skip to content

Commit

Permalink
workaround for #2785 and #2812
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jan 10, 2023
1 parent edede3c commit e4cf1b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/npm/node-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,12 @@ async function checkAndPreparePackage(): Promise<void> {
// path without modifying the code itself. Do not remove this because
// external code relies on this (in addition to esbuild's own test suite).
if (ESBUILD_BINARY_PATH) {
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
return;
if (!fs.existsSync(ESBUILD_BINARY_PATH)) {
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`)
} else {
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
return;
}
}

const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
Expand Down
6 changes: 5 additions & 1 deletion lib/npm/node-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ export function generateBinPath(): { binPath: string, isWASM: boolean } {
// path without modifying the code itself. Do not remove this because
// external code relies on this (in addition to esbuild's own test suite).
if (ESBUILD_BINARY_PATH) {
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
if (!fs.existsSync(ESBUILD_BINARY_PATH)) {
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`)
} else {
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
}
}

const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
Expand Down

0 comments on commit e4cf1b3

Please sign in to comment.