-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Description
Describe the bug
A function in a nested require is not correctly processed.
sodatea said on discord:
A small bug in Vite's resolution algorithm. There's a module field in callbag-from-event, while callbag-for-each only has main. https://unpkg.com/browse/callbag-from-event@1.3.0/package.json#L10 module has higher precedence in Vite than main. https://github.com/vitejs/vite/blob/a74bd7ba9947be193bccf636b8918bd1f59e89ae/packages/vite/src/node/plugins/resolve.ts#L778-L786The fix is similar to #7438 that module or jsnext fields should be skipped when it's initiated by a require call.
Reproduction
See https://stackblitz.com/edit/vitejs-vite-wthjcb?file=main.js
System Info
N/A
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
No labels