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(ssr): exclude module condition from ssr node resolve #16647

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented May 10, 2024

Description

It looks like vite:resolve plugin's tryNodeResolve doesn't set overrideConditions and it will end up including module as conditions and it's impossible to exclude it from user config:

const additionalConditions = new Set(
options.overrideConditions || [
'production',
'development',
'module',

This contracts with ssr module loader's node resolve, which explicitly exclude module conditions:

overrideConditions: [...overrideConditions, 'production', 'development'],

todo

  • check if the patch fixes the issue on Vitest
  • just excluding 'module' when !targetWeb would be too breaking?
  • should investigate cache issue?
  • what does environment api do?

Copy link

stackblitz bot commented May 10, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@hi-ogawa hi-ogawa changed the title fix: set node resolve overrideConditions during ssr resolveId fix(ssr): set node resolve overrideConditions for resolveId May 10, 2024
@hi-ogawa hi-ogawa changed the title fix(ssr): set node resolve overrideConditions for resolveId fix(ssr): set node resolve overrideConditions for resolveId (to exclude module condition) May 10, 2024
@hi-ogawa hi-ogawa changed the title fix(ssr): set node resolve overrideConditions for resolveId (to exclude module condition) fix(ssr): exclude module condition from ssr node resolve May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant