-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Labels
inconsistencyInconsistency between dev & buildInconsistency between dev & buildp2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Description
Describe the bug
Take the following dependency structure:
my-project
- dep-a@1.0.0
- dep-b
- dep-a@1.0.0
dep-a
should resolve to the same "instance" whether I access it directly (import depA from 'dep-a'
) or indirectly via dep-b
(e.g when it re-exports members from dep-a
or returns a dep-a
object, etc).
In dev mode this does not seem to be the case. I got back two separate "instances" from the same package, with the same version.
See the attached example where dep-a
is luxon@1.28.0
and dep-b
is cron-parser@4.3.0"
.
I think this is a regression in 2.9.0:
vite@2.9.1: example: different behaviour in prod and dev mode
- dev mode: the DateTime instances are different (different prototype, constructor name, etc)
- prod mode: works as expected, local and transitive code share the same DateTime instance
vite@2.8.6: example: works as expected
- dev/prod mode: identical, local and transitive code share the same DateTime instance
Luxon resolves to the same version (yarn why luxon
):
├─ cron-parser@npm:4.3.0
│ └─ luxon@npm:1.28.0 (via npm:^1.28.0)
│
└─ my-project@workspace:.
└─ luxon@npm:1.28.0 (via npm:^1.28.0)
Reproduction
https://stackblitz.com/edit/vitejs-vite-n3tocb?file=package.json
System Info
System:
OS: macOS 12.3.1
CPU: (8) arm64 Apple M1
Memory: 179.31 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 3.2.0 - ~/.nvm/versions/node/v16.14.0/bin/yarn
npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
Browsers:
Chrome: 100.0.4896.75
Safari: 15.4
npmPackages:
vite: 2.9.1 => 2.9.1
Used Package Manager
yarn
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.
ProTip
Metadata
Metadata
Assignees
Labels
inconsistencyInconsistency between dev & buildInconsistency between dev & buildp2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)