wasm-pack-plugin icon indicating copy to clipboard operation
wasm-pack-plugin copied to clipboard

test if wasm-pack in present

Open xtuc opened this issue 4 years ago • 0 comments

when wasm-pack isn't present it fails with something like:

/home/a/Code/wasm/node_modules/@wasm-tool/wasm-pack-plugin/plugin.js:210
        reject(new Error("Rust compilation."));
               ^

Error: Rust compilation.
    at ChildProcess.<anonymous> (/home/a/Code/wasm/node_modules/@wasm-tool/wasm-pack-plugin/plugin.js:210:16)
    at ChildProcess.emit (node:events:376:20)
    at maybeClose (node:internal/child_process:1063:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:376:20)
    at Pipe.<anonymous> (node:net:666:12)
Error: failed to execute `"/usr/bin/node" "/home/a/Code/wrangler2/wranglerjs" "--output-file=/tmp/.wranglerjs_outputhwu8d" "--wasm-binding=WASM_MODULE" "--webpack-config=webpack.config.js"`: exited with exit code: 1

improve the error by checking the binary in PATH first

xtuc avatar Jan 15 '21 16:01 xtuc