wasmerio / wasmer-pack

MIT License
49 stars 5 forks source link

@wasmer/wasi should only be imported when it is needed #58

Closed Michael-F-Bryan closed 2 years ago

Michael-F-Bryan commented 2 years ago

The JavaScript bindings were importing @wasmer/wasi all the time, however our package.json only adds the package when one or more libraries/commands was compiled with WASI. That mean you can run into "Cannot find package @wasmer/wasi" errors.

$ node --loader ts-node/esm index.ts
(node:2902591) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/tmp/tutorial-02/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:757
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base));
        ^
CustomError: Cannot find package '@wasmer/wasi' imported from /tmp/tutorial-02/node_modules/@wasmer/tutorial-02/src/bindings/index.js
    at packageResolve (/tmp/tutorial-02/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:757:9)
    at moduleResolve (/tmp/tutorial-02/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:798:18)
    at Object.defaultResolve (/tmp/tutorial-02/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
    at /tmp/tutorial-02/node_modules/ts-node/src/esm.ts:218:35
    at entrypointFallback (/tmp/tutorial-02/node_modules/ts-node/src/esm.ts:168:34)
    at /tmp/tutorial-02/node_modules/ts-node/src/esm.ts:217:14
    at addShortCircuitFlag (/tmp/tutorial-02/node_modules/ts-node/src/esm.ts:409:21)
    at resolve (/tmp/tutorial-02/node_modules/ts-node/src/esm.ts:197:12)
    at nextResolve (node:internal/modules/esm/loader:161:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:829:30)
github-actions[bot] commented 2 years ago

⏱ Workflow Timer ⏱

😥 The run time for "Continuous Integration" has regressed a bit by 24s (21.21%) 😥

The current run time is 2mins 21s while master took 1min 57s.