Skip to content

Commit c1f5f18

Browse files
authored
fix #4209: disable binary executable optimization on WASM platform (#4210)
1 parent 3ed5ecc commit c1f5f18

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/npm/node-install.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,13 @@ function maybeOptimizePackage(binPath: string): void {
185185
// place multiple times from different platforms, especially when people use
186186
// Docker. Avoid idempotency issues by just not optimizing when using Yarn.
187187
//
188+
// This also doesn't work with WASM because it is not a single binary executable
189+
// file. See https://github.com/evanw/esbuild/issues/4209
190+
//
188191
// This optimization also doesn't apply when npm's "--ignore-scripts" flag is
189192
// used since in that case this install script will not be run.
190-
if (os.platform() !== 'win32' && !isYarn()) {
193+
const { isWASM } = pkgAndSubpathForCurrentPlatform()
194+
if (os.platform() !== 'win32' && !isYarn() && !isWASM) {
191195
const tempPath = path.join(__dirname, 'bin-esbuild')
192196
try {
193197
// First link the binary with a temporary file. If this fails and throws an

0 commit comments

Comments
 (0)