Skip to content

Commit

Permalink
fix default wasm name for deno to esbuild.wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Dec 19, 2022
1 parent 29ae56a commit da0c253
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ test-wasm-browser: platform-wasm | scripts/browser/node_modules

test-deno: esbuild platform-deno
ESBUILD_BINARY_PATH="$(shell pwd)/esbuild" deno test --allow-run --allow-env --allow-net --allow-read --allow-write --no-check scripts/deno-tests.js
deno eval 'import { transform, stop } from "file://$(shell pwd)/deno/mod.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"
deno eval 'import { transform, stop } from "file://$(shell pwd)/deno/wasm.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"

test-deno-windows: esbuild platform-deno
ESBUILD_BINARY_PATH=./esbuild.exe deno test --allow-run --allow-env --allow-net --allow-read --allow-write --no-check scripts/deno-tests.js
Expand Down Expand Up @@ -206,6 +208,7 @@ test-e2e-yarn-berry:

test-e2e-deno:
deno eval 'import { transform, stop } from "https://deno.land/x/esbuild@v$(ESBUILD_VERSION)/mod.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"
deno eval 'import { transform, stop } from "https://deno.land/x/esbuild@v$(ESBUILD_VERSION)/wasm.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"

test-yarnpnp: platform-wasm
node scripts/test-yarnpnp.js
Expand Down
4 changes: 2 additions & 2 deletions lib/deno/wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let initializePromise: Promise<Service> | undefined;
let stopService: (() => void) | undefined

let ensureServiceIsRunning = (): Promise<Service> => {
return initializePromise || startRunningService('', undefined, true)
return initializePromise || startRunningService('esbuild.wasm', undefined, true)
}

export const initialize: typeof types.initialize = async (options) => {
Expand All @@ -68,7 +68,7 @@ export const initialize: typeof types.initialize = async (options) => {
let wasmModule = options.wasmModule;
let useWorker = options.worker !== false;
if (initializePromise) throw new Error('Cannot call "initialize" more than once');
initializePromise = startRunningService(wasmURL || '', wasmModule, useWorker);
initializePromise = startRunningService(wasmURL || 'esbuild.wasm', wasmModule, useWorker);
initializePromise.catch(() => {
// Let the caller try again if this fails
initializePromise = void 0;
Expand Down

0 comments on commit da0c253

Please sign in to comment.