Closed jcs224 closed 2 years ago
I'm not familiar with how Deno load packages. I think we can add the support of Deno to provide the loader.
Currently, loading wasm is done by load.ts, and is overridden in the browser environment. This behavior is controlled by package.json, which I think is not supported in Deno.
So what need to be done is making the load.ts
work on both node.js and deno.
Thanks for looking into this!
I did make an attempt to get it working with Deno. Because Deno is browser-first I tried going the load-browser.ts
route first. That was unsuccessful because while Deno has most of the JavaScript APIs of the browsers, it doesn't have DOM-related functionality (like document
or, in this case, Image
). There is also a node compatibility layer with Deno, that might be the route to take.
https://deno.land/manual@v1.16.2/npm_nodejs
The Deno Discord community is also quite helpful. The core Deno team also answers questions on occasion.
Also, the files require using the whole path, so you have to include the file extension on every import. For example:
import { CppObject } from './CppObject.ts';
After some surveying, I found that some patch need to be applied to make deno work.
I'd like to see if it would be possible to give guidance on how this library could be used with the Deno runtime. Deno is capable of running .wasm files and is focused on maintaining compatibility with web standards whenever possible.
Here's Deno's manual entry on WebAssembly.
https://deno.land/manual@v1.16.2/webassembly/using_wasm
Would this be feasible?