Replies: 2 comments 2 replies
-
Very nice! Out of interest, why did you use WASM, rather than Node-API (via napi-rs)? I imagine a NAPI-RS version would be a bit faster. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I had a look at the code for your loader. You're right, it's surprisingly (and pleasantly) simple! However, I've found what I think is a memory usage problem in your current implementation. Have opened an issue on the repo hackbg/ganesha#23. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Compiling TS on demand has been a major pain point for me. So when they dragged me kicking and screaming onto the TypeScript bandwagon, first thing I did was write a Node.js loader to make sure "build and run" stays one command and not two. (That, and the extensions.) 💫
That loader was @hackbg/ganesha, and today I upgraded it to use a WebAssembly build of Oxc, courtesy of wasm-pack - as well as the stabilizing Node 20+ Loader API.
If you're interested, the code is at https://github.com/hackbg/ganesha and the package at https://www.npmjs.com/package/@ganesha/oxc 🐘
Some more info: Ganesha v4 used
esbuild
, and was getting excruciatingly slow for large repos (like the one I'm wrangling currently). v4 had also accumulated a considerable amount of legacy cruft, which is not currently relevant to my work. Unlike v4, the Oxc-based Ganesha v5 is short and sweet; haven't benchmarked yet, but so far v5 feels at least twice as fast. 🏃Plus, putting it together was a breeze! I'm honestly surprised at how smoothly it all worked out 🚀
The main feature it's currently missing is source map support, so that the line numbers in stack traces would make sense. Where should I look for source maps? (tbh for Node loaders I'd prefer to not use source maps, but instead replace all TS-specific tokens with whitespace, so that line/char numbers would match in the source and compiled code; source maps I'd rather use when bundling/minifying 🤔)
Beta Was this translation helpful? Give feedback.
All reactions