Skip to content

import.meta.env undefined after upgrade from 405 to 432 #6259

@sidharthv96

Description

@sidharthv96

Describe the bug

import.meta.env is undefined after upgrading to v432, causing vitest to fail.

image

Reproduction

PR of the upgrade branch. Only contains changes for the upgrade.

Logs

❯ node_modules/@sveltejs/kit/src/runtime/app/env.js:4:41
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/lib/util/serde.test.ts [ src/lib/util/serde.test.ts ]
      2|  * @type {import('$app/env').browser}
      3|  */
      4| export const browser = !import.meta.env.SSR;
       |                                         ^
      5| 
      6| /**
 ❯ async /Users/sidv/dev/mermaid-live-editor/src/lib/util/stats.ts:1:256
 ❯ async /Users/sidv/dev/mermaid-live-editor/src/lib/util/state.ts:5:31
 ❯ async /Users/sidv/dev/mermaid-live-editor/src/lib/util/serde.test.ts:5:31

TypeError: CTest Files  1 failed | 1 passed (2)
     Tests  1 passed (1)
  Start at  10:12:58
  Duration  1.53s (transform 974ms, setup 110ms, collect 795ms, tests 15ms)

annot read properties of undefined (reading 'SSR')
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

System Info

System:
    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 66.52 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.17.0 - /var/folders/~~/node
    Yarn: 1.22.19 - /var/folders/~~/yarn
    npm: 8.18.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 103.0.2
    Safari: 15.4
  npmPackages:
    @sveltejs/adapter-static: 1.0.0-next.39 => 1.0.0-next.39 
    @sveltejs/kit: 1.0.0-next.432 => 1.0.0-next.432 
    svelte: 3.49.0 => 3.49.0 
    vite: 3.0.9 => 3.0.9 

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions