Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] importing dependencies by fs paths results in two different copies of the same module (Same as #2503) #7621

Closed
7 tasks done
meteorlxy opened this issue Apr 5, 2022 · 1 comment · Fixed by #9848

Comments

@meteorlxy
Copy link
Contributor

meteorlxy commented Apr 5, 2022

Describe the bug

Almost the same as #2503.

The only difference is that, node_modules is not inside vite root:

-import fooSymbol from './node_modules/foo'
+import fooSymbol from '../node_modules/foo'
-import barSymbol from './node_modules/bar'
+import barSymbol from '../node_modules/bar'

I've updated the reproduce repo -> https://github.com/meteorlxy/repro-vite-2503

@patak-dev I think it's not a regression. In fact I found that #2848 did not fully fix that issue at that time. I just remembered now to look further into this problem 😅

Reproduction

https://github.com/meteorlxy/repro-vite-2503

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
    Memory: 21.89 GB / 24.98 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.14.2 - /usr/local/lib/node/bin/node
    Yarn: 1.22.18 - /usr/local/lib/node/bin/yarn
    npm: 8.5.0 - /usr/local/lib/node/bin/npm
  npmPackages:
    vite: ^2.9.1 => 2.9.1

Used Package Manager

npm

Logs

No response

Validations

@meteorlxy
Copy link
Contributor Author

UPDATE

cc @Bigfish8

I updated the reproduction repo with another case - importing from a sub directory in a bare import.

import fooSymbol from 'foo/foo'

export default fooSymbol
import fooSymbol from 'foo'

export default fooSymbol

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.