Describe the bug
Hi! I've ran into an issue where I can't import a dependency from node modules with a variable. But without a variable, it works. I also tried using a variable for a "local" import and that also works.
I've attached a minimal reproduction, that uses dayjs as an example.
Reproduction
original: https://stackblitz.com/edit/vitejs-vite-rb9v1k?file=src%2FApp.tsx
vite 5.4.2 (same issue): https://stackblitz.com/edit/vitejs-vite-cc4fvd?file=src%2FApp.tsx
(check console)
Steps to reproduce
No response
System Info
System:
OS: macOS 13.3
CPU: (8) arm64 Apple M1
Memory: 119.72 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.3.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.8.0 - /usr/local/bin/npm
pnpm: 8.2.0 - /usr/local/bin/pnpm
Browsers:
Chrome: 115.0.5790.170
Firefox Nightly: 114.0a1
Safari: 16.4
Used Package Manager
yarn
Logs
TypeError: Failed to resolve module specifier 'dayjs/locale/en'
Validations
Describe the bug
Hi! I've ran into an issue where I can't import a dependency from node modules with a variable. But without a variable, it works. I also tried using a variable for a "local" import and that also works.
I've attached a minimal reproduction, that uses dayjs as an example.
Reproduction
original: https://stackblitz.com/edit/vitejs-vite-rb9v1k?file=src%2FApp.tsx
vite 5.4.2 (same issue): https://stackblitz.com/edit/vitejs-vite-cc4fvd?file=src%2FApp.tsx
(check console)
Steps to reproduce
No response
System Info
System: OS: macOS 13.3 CPU: (8) arm64 Apple M1 Memory: 119.72 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.3.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.8.0 - /usr/local/bin/npm pnpm: 8.2.0 - /usr/local/bin/pnpm Browsers: Chrome: 115.0.5790.170 Firefox Nightly: 114.0a1 Safari: 16.4Used Package Manager
yarn
Logs
TypeError: Failed to resolve module specifier 'dayjs/locale/en'Validations