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

Inconsistent import.meta.env.SSR (false on vmThreads pool and true on other pools) #5562

Open
6 tasks done
hi-ogawa opened this issue Apr 18, 2024 · 0 comments
Open
6 tasks done
Labels
feat: vm pool Issues related to VM pool p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@hi-ogawa
Copy link
Contributor

Describe the bug

While making a PR #5561, I just found import.meta.env.SSR works differently on vmThreads.

npm run test
{
  'import.meta.env.PROD': true,
  'import.meta.env.DEV': true,
  'import.meta.env.SSR': true,
  'process.env.PROD': 'false',
  'process.env.DEV': 'true',
  'process.env.SSR': '1'
}

npm run test -- --pool vmThreads --disable-console-intercept
{
  'import.meta.env.PROD': true,
  'import.meta.env.DEV': true,
  'import.meta.env.SSR': false,
  'process.env.PROD': 'false',
  'process.env.DEV': 'true',
  'process.env.SSR': undefined
}

It looks like console is not working on vmThreads, so I needed to use --disable-console-intercept here.

Reproduction

https://github.com/hi-ogawa/reproductions/tree/main/vitest-env

vmThreads doesn't seem to run on Stackblitz

System Info

System:
    OS: Linux 6.8 Arch Linux
    CPU: (12) x64 AMD Ryzen 5 5625U with Radeon Graphics
    Memory: 2.69 GB / 14.98 GB
    Container: Yes
    Shell: 5.2.26 - /bin/bash
  Binaries:
    Node: 20.12.2 - ~/.volta/tools/image/node/20.12.2/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 10.5.0 - ~/.volta/tools/image/node/20.12.2/bin/npm
    pnpm: 8.15.7 - ~/.volta/bin/pnpm
    bun: 1.0.26 - ~/.volta/bin/bun
  Browsers:
    Chromium: 123.0.6312.122
  npmPackages:
    vitest: 1.5.0 => 1.5.0

Used Package Manager

npm

Validations

@hi-ogawa hi-ogawa added pending triage feat: vm pool Issues related to VM pool p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: vm pool Issues related to VM pool p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

1 participant