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

vite-node no longer has node_modules as a default for moduleDirectories #3791

Closed
6 tasks done
luxaritas opened this issue Jul 21, 2023 · 1 comment · Fixed by #3830
Closed
6 tasks done

vite-node no longer has node_modules as a default for moduleDirectories #3791

luxaritas opened this issue Jul 21, 2023 · 1 comment · Fixed by #3830
Milestone

Comments

@luxaritas
Copy link

luxaritas commented Jul 21, 2023

Describe the bug

I initially noticed that vite-node was not performing esm/cjs interop on third party dependencies, when I expected it to out of the box (and was pretty sure it had previously). Digging into this further, it looks like this is due to #3446 - the moduleDirectories array is initialized to [] in server.ts so that VITE_NODE_DEPS_MODULE_DIRECTORIES can be added to it, however the default of ['/node_modules/'] is not applied until it's used in externalize.ts (and so the fallback codepath is never hit)

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-5ibjqp

System Info

System:
    OS: Linux 6.4 Manjaro Linux
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 5.01 GB / 15.27 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.16.0 - /usr/bin/node
    npm: 9.8.0 - /usr/bin/npm
    pnpm: 7.19.0 - /usr/bin/pnpm
  Browsers:
    Chromium: 115.0.5790.90
  npmPackages:
    vite: ^4.4.4 => 4.4.4 
    vitest: ^0.33.0 => 0.33.0

Used Package Manager

npm

Validations

@stackblitz
Copy link

stackblitz bot commented Jul 21, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sheremet-va sheremet-va added this to the 0.34.0 milestone Jul 28, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants