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

optimizeDeps.entries doesn't work when it's inside node_modules but not inside any packages #13782

Closed
7 tasks done
Jinjiang opened this issue Jul 11, 2023 · 2 comments
Closed
7 tasks done

Comments

@Jinjiang
Copy link
Contributor

Describe the bug

I have an entry file that needs to be specified manually. After upgrading to 4.4.2 it doesn't work.

Reproduction

https://github.com/Jinjiang/reproductions/tree/vite-optimize-deps-entries-20230711

Steps to reproduce

How to reproduce:

pnpm install
pnpm dev

Then uncomment the line 2 in main.js and save the file. The error will be thrown in browser console.

Uncaught SyntaxError: The requested module '/node_modules/foo/index.js?v=2366fb81' does not provide an export named 'foo'

With vite@4.4.0-beta.0 it works.

System Info

System:
    OS: macOS 14.0
    CPU: (8) arm64 Apple M1
    Memory: 60.47 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.asdf/installs/nodejs/16.15.0/bin/node
    Yarn: 1.22.19 - ~/.asdf/shims/yarn
    npm: 8.5.5 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 8.5.1 - ~/Library/pnpm/pnpm
  Browsers:
    Safari: 17.0
  npmPackages:
    vite: 4.4.2 => 4.4.2

Used Package Manager

pnpm

Logs

Uncaught SyntaxError: The requested module '/node_modules/foo/index.js?v=2366fb81' does not provide an export named 'foo'

Validations

@Jinjiang Jinjiang changed the title optimizeDeps.entries doesn't work when it's inside node_modules but inside any packages optimizeDeps.entries doesn't work when it's inside node_modules but not inside any packages Jul 11, 2023
@patak-dev
Copy link
Member

It looks like you were relying on a bug in fast-glob. Negative patterns didn't affect hidden files before 3.3.0. It was fixed here:

Entries inside node_modules should have never worked in Vite, the feature was always intended to get entries from the user source code. We didn't have need for this before, so if there is a way to restructure things in your project I think it would be better to avoid adding complexity on Vite's side.

@Jinjiang
Copy link
Contributor Author

@patak-dev Understood. I think I already found some walkarounds in my project. Thanks for the information!

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

No branches or pull requests

2 participants