`module_init` installs a global tracing subscriber with `init()`, which panics or takes over the host's subscriber when embedded
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #813 by @Brooooooklyn — merged
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 67/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, rust, typescript
- Domain
- devtools
Research direction
Start with src/lib.rs lines 361–379, where module_init calls init(), and compare the tracing setup with the host behavior described in the issue. The issue identifies try_init() as the smallest proposed change; verify how it handles an existing global subscriber. Done means addon loading no longer panics or takes over the host’s subscriber, while @oxc-node/core retains its current behavior.
Written by the indexing model from the issue text.
Description
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_initpanics 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 byOXC_LOG, and dropped entirely whenOXC_LOGis 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_LOGis set; - gate the
module_initregistration 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.
- Dominant language
- TypeScript
- Stars
- 269
- Forks
- 10
- Avg merge
- 5h 19m
- Merged PRs (30d)
- 75
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from oxc-project/oxc-node
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
oxc-project/oxc-node#891 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
oxc-project/oxc-node#449 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
oxc-project/oxc-node#329 ·
Maintainers usually reply within 1 day
All issues in oxc-project/oxc-node
Similar issues
-
needs-area-label
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
liberation-data/drivine#615 ·
Maintainers usually reply within 1 day
-
backend bug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
geolens-io/geolens#3639 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
radius-project/ai-extensions#1196 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 88/100