Skip to content

Support for "module-sync" exports condition #531

@zllkjc

Description

@zllkjc

Hello, we are currently using @vercel/nft to collect dependencies for our application. Thanks the capabilities it provides, which have saved us a significant amount of server resources and deployment time."

But recently we encountered a problem. When a package uses module-sync exports, some unexpected behaviors occur.

When using higher versions of Node 22, the exports of module-sync are used at runtime. However, the collected dependencies are require, node or default. These exported files may not be consistent with module-sync, so running with the collected dependencies might lead to issues where files cannot be found.


I would like to know if @vercel/nft will support the module-sync exports condition. If there are plans, I can try to provide a PR.

However, what I am currently unsure about is whether we should consider the situation where the build and deployment are on different Node versions. For example, the build uses Node 22 while the deployment uses Node 20. Although this is not a correct practice, it indeed exists widely. If we need to consider this difference, perhaps a configuration option should be provided, or there might already be an existing option that I am unaware of but can adapt to this scenario.

Please correct me if I have any misunderstandings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions