-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
Running vite build works in sveltekit @2.38.1 but fails in 2.39.0 -> 2.41.0 versions the issue appears to occur due to changes in https://github.com/sveltejs/kit/blob/3120d170b157b5a00369b3ee66d3cbe4d3c6fc03/packages/kit/src/exports/vite/index.js
These are the errors I am seeing:
[plugin vite-plugin-sveltekit-remote] Sourcemap is likely to be incorrect: a plugin (vite-plugin-sveltekit-remote) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help (x4)
and
node:internal/event_target:1101
process.nextTick(() => { throw err; });
^
ReferenceError [Error]: Cannot access 'info_v2' before initialization
at file:///Users/em/Dev/app/.svelte-kit/output/server/chunks/remote-eooeoj.js:1288:91
at ModuleJob.run (node:internal/modules/esm/module_job:345:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26)
at async analyse (file:///Users/em/Dev/app/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js:51:19)
at async MessagePort.<anonymous> (file:///Users/em/Dev/app/node_modules/@sveltejs/kit/src/utils/fork.js:23:16)
Reproduction
This is difficult to reproduce as it seems to only occur when the generated remote files are large and split into multiple files.
Logs
System Info
System:
OS: macOS 15.6
CPU: (12) arm64 Apple M2 Max
Memory: 988.89 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.19.0 - ~/.volta/tools/image/node/22.19.0/bin/node
Yarn: 4.9.4 - ~/.volta/tools/image/yarn/4.9.4/bin/yarn
npm: 11.6.0 - ~/.volta/tools/image/npm/11.6.0/bin/npm
bun: 1.2.0 - ~/.volta/bin/bun
Browsers:
Brave Browser: 121.1.62.156
Edge: 140.0.3485.66
Safari: 18.6
npmPackages:
@sveltejs/adapter-node: ^5.3.2 => 5.3.2
@sveltejs/enhanced-img: ^0.8.1 => 0.8.1
@sveltejs/kit: 2.41.0 => 2.41.0
@sveltejs/vite-plugin-svelte: ^6.2.0 => 6.2.0
svelte: 5.38.10 => 5.38.10
vite: 7.1.5 => 7.1.5Severity
blocking an upgrade
Additional Information
Not that this helps much but the line in question occurs in what is essentially a compiled version of a bunch of drizzle queries in one big file. Specifically it looks like this.
const { date: _info_date, ...provider_info_v2_columns } = getTableColumns(info_v2);
Well above that line 1288, on line 27 is
import { i as info_v2, ... } from "./remote-12p15ba.js";
And that remote file seems to be the drizzle schema, at the end of the file.
export {
info_v2 as i,
...
}
So the output seems correct but for whatever reason it is complaining that the drizzle table has not yet been initialized, which leads me to believe it is attempting to run the code in the build environment without the imports.