Skip to content

Support non-standard "use exports field for directory resolution" behavior #571

@sapphi-red

Description

@sapphi-red

Vite currently uses exports field when resolving directory specifiers.
For example, when import './dir' is written, Vite uses exports field of ./dir/package.json if exists.

Node.js does not use exports field in this case (nodejs/node#58827). While Vite probably should not have supported this, there are some code that relies on this behavior (nuxt, Vitest). We prefer to not break these if possible.

To achieve that, it would be nice if oxc-resolver adds an option that opt-in to this behavior.

related: vitejs/vite#20252

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions