-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Open
Labels
feat: deps optimizerEsbuild Dependencies OptimizationEsbuild Dependencies Optimizationp4-importantViolate documented behavior or significantly improves performance (priority)Violate documented behavior or significantly improves performance (priority)
Description
Describe the bug
I am using a monorepo package and an app consuming it. They both use different versions of a dependency
Vite uses the version specified in app, even when importing it from the internal package
I expect Vite to use version of a package that is specified in internal package's package.json for the package and the version in app's package.json for app code (not the package code)
For me personally it happens with yarn 3, but I reproduced it on stackblitz using pnpm
To represent the issue I used:
nanoid@2.0.0 for package that is using default export
nanoid@3.0.0 for app that is using named export
Reproduction
https://stackblitz.com/edit/github-zdg7ym-1hbqbp?file=package%2Findex.jsx
System Info
Note, this is my local system info where it failed with yarn, I wasn't able to run it in stackblitz
System:
OS: macOS 13.0
CPU: (10) x64 Apple M1 Max
Memory: 469.47 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.18.2 - ~/Library/Caches/fnm_multishells/926_1661596049762/bin/node
Yarn: 3.2.3 - ~/Library/Caches/fnm_multishells/926_1661596049762/bin/yarn
npm: 8.5.4 - ~/Library/Caches/fnm_multishells/926_1661596049762/bin/npm
Browsers:
Brave Browser: 104.1.42.86
Chrome: 104.0.5112.101
Firefox: 103.0.2
Safari: 16.0
npmPackages:
@vitejs/plugin-react: 3.1.0 => 3.1.0
vite: 4.1.2 => 4.1.2
Used Package Manager
yarn
Logs
Click to expand!
Error in browser ```shell Uncaught SyntaxError: import not found: default ```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 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.
unionaljeegurda and grigored
Metadata
Metadata
Assignees
Labels
feat: deps optimizerEsbuild Dependencies OptimizationEsbuild Dependencies Optimizationp4-importantViolate documented behavior or significantly improves performance (priority)Violate documented behavior or significantly improves performance (priority)