demergent-labs / azle

A WebAssembly runtime for TypeScript and JavaScript on ICP
MIT License
190 stars 33 forks source link

Implement ES Modules and require #1769

Open lastmjs opened 1 month ago

lastmjs commented 1 month ago

What if we actually use QuickJS' ES Modules implementation, and implement require? Then we would just copy over all files into the filesystem and read them from there. This could get rid of weird issues that come from bundling. The idea would be to be like Zwitterion or I think Vite, and just transpile individual files as they're written to disc, or maybe even in real time like ts-node.

Then our bundler won't have to change ES Modules to its own weird require, and we won't have to deal with bundling everything even dynamic imports all at once.

Just an idea, might not be worth it, but maybe. We would also have to deal with bare specifiers.