kit icon indicating copy to clipboard operation
kit copied to clipboard

Failed to statically analyse src/routes/ Unexpected token error for loader with async generic function

Open minht11 opened this issue 6 months ago • 0 comments

Describe the bug

After https://github.com/sveltejs/kit/pull/13684 I get Failed to statically analyse when I have additional function with generics:

// import {} from './config'

const loadDataWithGeneric = async <T>() => {};

export const load = () => {};

Comment is needed as well, to trigger it.

Reproduction

Reproduction

Logs

SyntaxError: Failed to statically analyse src/routes/(app)/+layout.ts. Unexpected token (3:40)
...
acorn/dist/acorn.mjs:596:15) {
  pos: 70,
  loc: Position { line: 3, column: 40 },
  raisedAt: 72
}

System Info

npmPackages:
    @sveltejs/adapter-static: ^3.0.8 => 3.0.8 
    @sveltejs/kit: ^2.21.1 => 2.21.1 
    @sveltejs/vite-plugin-svelte: 5.0.3 => 5.0.3 
    rolldown-vite:  6.3.10 
    svelte: ^5.31.1 => 5.31.1

Severity

blocking an upgrade

Additional Information

No response

minht11 avatar May 20 '25 14:05 minht11