parcel-bundler / parcel

The zero configuration build tool for the web. πŸ“¦πŸš€

Home Page:https://parceljs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parcel Macro in the REPL

yfzhe opened this issue Β· comments

πŸ› bug report

Parcel Macro and the REPL are both great features! However, it failed when I tried to write macros in the REPL.

For simplification, I use the code from the getRandomNumber example of macros: REPL link

πŸ€” Expected Behavior

console.log(/* a random number here */);

😯 Current Behavior

(function () {
function $fe2e15112bb76575$export$eab19c48dcb6310d() {
    return Math.random();
}


console.log((0, $fe2e15112bb76575$export$eab19c48dcb6310d)());

})();

🌍 Your Environment

// It says "Based on commit 2059029ee9" in the REPL.

Yeah I think it doesn't work in the wasm build yet. We'd need to do something like lightningcss using the asyncify transform to support async functions called from rust. https://github.com/parcel-bundler/lightningcss/blob/master/wasm/async.mjs