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

fix: ensure version query for relative node_modules imports #10016



Copy link

@ElMassimo ElMassimo commented Sep 6, 2022


This is a follow-up to:

It ensures that relative imports inside node_modules are rewritten to include the version hash.

Additional context

This problem can cause duplicate modules in development, such as:

What is the purpose of this pull request?

  • Bug fix

Before submitting the PR, please make sure you do the following

Attempted to create a test case that would trigger this problem, by adding a file inside dep-non-optimized with a relative import to index.js:

  id: './index',
  resolved: '.../node_modules/.pnpm/file+playground+optimize-deps+dep-non-optimized/node_modules/dep-non-optimized/index.js',
  isNodeModule: false,

After the fix:

  isNodeModule: true,

Unfortunately, the bug is not triggered because in this test scenario most imports are later rewritten in the /@fs/ code path (circumventing the problem), so it's not valuable as a test case.

@patak-dev patak-dev merged commit 1b822d0 into vitejs:main Sep 6, 2022
15 checks passed
@ElMassimo ElMassimo deleted the fix/relative-node-modules-version-hash branch Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants