-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Fixing repl #9912
WIP: Fixing repl #9912
Conversation
use napi::Env; | ||
use napi::JsObject; | ||
use napi::JsUnknown; | ||
use napi_derive::napi; | ||
|
||
#[napi] | ||
pub fn transform(opts: JsObject, env: Env) -> napi::Result<JsUnknown> { | ||
let config: parcel_js_swc_core::Config = env.from_js_value(opts)?; | ||
let config = parcel_js_swc_core::Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@devongovett Any idea on why from_js_value
fails to deserialize the value for wasm but not napi? The error was expected $name, got -1
.
Is it okay to commit manually constructing the struct like this rather than using serde?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we change things in Config
since the repl broke?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to log the value getting passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like that error comes from here: https://github.com/napi-rs/napi-rs/blob/8b6cc10d779f94601775910e90d22067987fb0f7/crates/napi/src/bindgen_runtime/js_values/arraybuffer.rs#L702
Could be due to the upgrade of napi-rs somehow being incompatible with napi-wasm. I will investigate.
Closing in favor of #9936. |
There were two issues:
env.from_js_value()
was failing at runtime for wasm builds (I'm not sure why atm)env.from_js_value
to manually constructing the target struct@parcel/node-resolver-core/ResolverBase
had a conditional statement to select the old vs new resolver which was failing at runtime for wasm builds.BaseResolver
property to agetBaseResolver()
function