Skip to content

module field takes precedence over exports in package.json #11114

@posva

Description

@posva

Describe the bug

Vite seems to prioritize the module field instead of the exports like node does when importing from a library.

I found this problem while using Firebase with Nuxt: it failed during dev but worked after building the project for production and serving the app with node. These are the other issues I found

Reproduction

https://stackblitz.com/edit/vitejs-vite-csrnaz

Steps to reproduce

  • npm i + npm run dev -> outputs module
  • node main.js -> outputs exports

It should always output exports

System Info

na

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p4-importantViolate documented behavior or significantly improves performance (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions