Skip to content

[feature] Isolate node:async_hooks usage so it's not bundled when unused #403

Description

@dinwwwh

Problem or motivation

Image

asyncStorageScope.ts imports node:async_hooks unconditionally:
https://github.com/HugoRCD/evlog/blob/main/packages/evlog/src/shared/asyncStorageScope.ts

This means the dependency gets pulled into the bundle even for consumers who don't use the async-storage-scope feature. In environments like Cloudflare Workers, this forces the nodejs_compat compatibility flag to be enabled, even when nothing in the app actually relies on it.

Proposed feature

Node-dependent features (like async_hooks) should be exported from a separate entry point, rather than bundled with the core package. This way, consumers who don't need those features aren't forced to pull in Node-specific dependencies or enable compatibility flags for runtimes that don't support them.

Possible implementation (optional)

No response

Alternatives you’ve considered (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions