Skip to content

Please consider adding a default export to your modules. #405

@wraithgar

Description

@wraithgar

With the switch to ESM these packages are not exceptionally hard to get into existing CJS packages. If any of them need top level synchronous access, they are out of luck. This is of particular concern for npm itself, as it has some pretty unique requirements about how its tree is built (asynchronous imports are very dangerous during the npm install -g npm process, as things the current runtime may later need can have been deleted from the filesystem).

Under some cases we can get away with importing inside of a function instead of at the top level of a package, but for some of our packages this won't work, as they extend these classes and need these packages at the top level of their files, not inside another function.

We could refactor all of our code that uses these proxies to have generators returning these classes, but a simpler solution is to start exporting a default. This of course only works for packages that do not have a top level await. Fortunately this seems to be a case for these agents.

The alternatives here are going to be a mountain of work so we'd like to know soonish if this is going to be possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions