Closed
Description
Describe the bug
After updating sveltekit from 2.6.2 to 2.6.3, the build version of the app is broken on startup with the following error
public.Dvbes-1E.js:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'env')
at public.Dvbes-1E.js:1:376
The code that is running is
const d = globalThis.__sveltekit_1n0gls.env;
I can see that globalThis.__sveltekit_1n0gls
doesn't exist, but globalThis.__sveltekit_aqr0w
does. So it seems like somehow the keys gets mixed up in the build. I suspect introduced in #12700
Reproduction
- Create a new sveltekit project, and make a build
- Take note of the variable name
globalThis.__sveltekit_*
inclient/_app/immutable/chunks/entry.*.js
- Make a change to package.json, for example add a new dependency
- Make new build, notice that the
entry.*.js
file has not changed filename (same key), but thatglobalThis.__sveltekit_*
has changed key, so the file has become mutable
The build is still valid by itself, but if application is served behind a cdn, the old file will be served since filename doesnt change.
Logs
No response
System Info
System:
OS: macOS 14.6.1
CPU: (12) arm64 Apple M2 Max
Memory: 2.38 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
pnpm: 9.1.1 - ~/.nvm/versions/node/v20.15.1/bin/pnpm
bun: 1.1.5 - ~/.bun/bin/bun
Browsers:
Chrome: 129.0.6668.90
Safari: 17.6
npmPackages:
@sveltejs/adapter-node: 5.2.5 => 5.2.5
@sveltejs/enhanced-img: 0.3.8 => 0.3.8
@sveltejs/kit: 2.6.3 => 2.6.3
svelte: 4.2.19 => 4.2.19
vite: 5.4.8 => 5.4.8
Severity
blocking an upgrade
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels