but changing #[napi(constructor)] to #[cfg_attr(feature = "nodejs", napi(constructor))] will fail:
error: associated `static` items are not allowed
--> ….rs:13:36
|
13 | #[cfg_attr(feature = "nodejs", napi(constructor))]
| ^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `napi::bindgen_prelude::ctor` (in Nightly builds, run with -Z macro-backtrace for more info)
Hello,
This issue is similar to https://github.com/napi-rs/napi-rs/issues/1120. The following code is working:
but changing
#[napi(constructor)]
to#[cfg_attr(feature = "nodejs", napi(constructor))]
will fail:etc.