You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
module_init installs a global tracing subscriber with init(), which panics or takes over the host's subscriber when embedded #805
init() runs as the addon's module_init and installs a global tracing subscriber with SubscriberInitExt::init() (src/lib.rs#L361-L379). init() panics if a global subscriber is already installed.
This runs on every load, including when oxc-node's crate is linked into another Node-API addon that sets up its own tracing. Vite+ does this: its binding installs a subscriber for its VP_LOG variable with try_init(). Depending on which runs first:
if the host's subscriber is installed first, oxc-node's module_init panics while the addon loads;
if oxc-node's runs first, it becomes the global default, so the host's try_init() does nothing: the host's events are filtered by OXC_LOG, and dropped entirely when OXC_LOG is unset.
Proposal
Any one of these lets a host keep its subscriber:
use try_init() and ignore the error;
install the subscriber only when OXC_LOG is set;
gate the module_init registration behind a default-on feature that embedders can turn off.
try_init() is the smallest change and keeps today's behavior for @oxc-node/core.
Today Vite+ removes the module_init attribute in a patch.
Activity
fix: don't take over the host's global tracing subscriber (#813)