Vite prefers the file specified in module
to exports
under the certain situations
#11676
Closed
7 tasks done
Labels
Describe the bug
Vite prefers the file specified in
module
toexports
under the following situations.exports
andmodule
fields on package.jsonexports.import
is.mjs
(withjs
, the problem does not happen)Because of this behavior, we cannot build some libraries like
y18n
; a dependency ofyargs
.https://github.com/yargs/y18n/blob/master/package.json#L8
Reproduction
https://github.com/tasshi-playground/repro-vite-prefers-module-to-exports
Steps to reproduce
Run
npm install
andnpm run build
System Info
Used Package Manager
npm
Logs
Vite failed to build output.
That's because the file specified in
module
field is loaded. (old.mjs
).(To make it easier to understand the impact, the
./lib/old.mjs
is a deprecated file, and the interface is different from./lib/index.mjs
.)vite build
vite build --debug
Validations
The text was updated successfully, but these errors were encountered: