kit icon indicating copy to clipboard operation
kit copied to clipboard

$inspect() Rune breaks build with remote functions

Open garytube opened this issue 1 month ago • 4 comments

Describe the bug

Remote function output breaks build when used in $inspect rune

Reproduction

	const events = $derived(await getEvents());   // remote function
	const displayEvents = $derived(limit > 0 ? events.slice(0, limit) : events);

	$inspect(events);  //  <<< **🔥 this breaks the build**
error during build:
src/lib/components/track-event.svelte (25:14): Expression expected (Note that you need plugins to import files that are not JavaScript)
file: /home/geryy/triple-m/bw/packages/website/src/lib/components/track-event.svelte:25:14

23:       async () => events = await getEvents({ exclude_old }),
24:       () => displayEvents = limit > 0 ? events.slice(0, limit) : events,
25:       () => void ;
                     ^
26:     ]);

    at getRollupError (file:///home/xxx/website/bw/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:401:41)

Logs

src/lib/components/track-event.svelte (25:14): Error when using sourcemap for reporting an error: Can't resolve original location of error.
✓ 79 modules transformed.
✗ Build failed in 451ms
error during build:
src/lib/components/track-event.svelte (25:14): Expression expected (Note that you need plugins to import files that are not JavaScript)
file: /home/xxxx/website/bw/packages/website/src/lib/components/track-event.svelte:25:14

23:       async () => events = await getEvents({ exclude_old }),
24:       () => displayEvents = limit > 0 ? events.slice(0, limit) : events,
25:       () => void ;
                     ^
26:     ]);

    at getRollupError (file:///home/xxxx/website/bw/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:401:41)
    at ParseError.initialise (file:///home/xxxx/website/bw/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:14469:28)
    at convertNode (file:///home/xxxx/website/bw/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:16352:10)
    at convertProgram (file:///home/xxxx/website/bw/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:15592:12)
    at Module.setSource (file:///home/xxxx/website/bw/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17352:24)
    at async ModuleLoader.addModuleSource (file:///home/xxxx/website/bw/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:21377:13)
Waiting for the debugger to disconnect...
 ELIFECYCLE  Command failed with exit code 1.

System Info

System:
    OS: Linux 6.6 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700KF
    Memory: 8.64 GB / 15.54 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 24.11.0 - /home/gary/.nvm/versions/node/v24.11.0/bin/node
    npm: 11.6.1 - /home/gary/.nvm/versions/node/v24.11.0/bin/npm
    pnpm: 10.23.0 - /home/gary/.local/share/pnpm/pnpm
    bun: 1.3.2 - /home/gary/.bun/bin/bun
    Deno: 2.3.3 - /home/gary/.deno/bin/deno
  Browsers:
    Chrome: 142.0.7444.134
    Chromium: 142.0.7444.175
  npmPackages:
    @sveltejs/adapter-node: ^5.4.0 => 5.4.0 
    @sveltejs/enhanced-img: ^0.8.5 => 0.8.5 
    @sveltejs/kit: ^2.49.0 => 2.49.0 
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1 
    svelte: ^5.45.2 => 5.45.2 
    vite: ^7.2.4 => 7.2.4

Severity

serious, but I can work around it

Additional Information

No response

garytube avatar Nov 28 '25 13:11 garytube

I'm seeing this too and I believe it's linked to the bun adapter. i switched to the node adapter and the error doesn't show up

alexvdvalk avatar Dec 04 '25 00:12 alexvdvalk

We'll need a minimal reproduction shared as a repository to troubleshoot the issue.

teemingc avatar Dec 04 '25 02:12 teemingc

Reproduction here: https://github.com/alexvdvalk/sveltekit-bun-inspect-bug

The problem is with the bun adapter and the async svelte compiler options.

To Test: npm run build - notice it fails. then comment out the $inspect command on line 6 npm run build - succeeds

when i disable async svelte, it works

alexvdvalk avatar Dec 05 '25 16:12 alexvdvalk

it also happens on auto adapter on vercel

Peter-512 avatar Dec 10 '25 10:12 Peter-512