Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal compiler error: let directive at invalid position. #9710

Closed
CropWatchDevelopment opened this issue Nov 30, 2023 · 3 comments · Fixed by #9723
Closed

Internal compiler error: let directive at invalid position. #9710

CropWatchDevelopment opened this issue Nov 30, 2023 · 3 comments · Fixed by #9723

Comments

@CropWatchDevelopment
Copy link

Describe the bug

Getting a build time error:

Internal compiler error: let directive at invalid position. Please report this to https://github.com/sveltejs/svelte/issues
  Plugin: vite-plugin-svelte
  File: /home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/TreeList.svelte:25:53
  25 |      <li
  26 |        class={cls(
  27 |          typeof theme.li === 'string' ? theme.li : theme.li?.(node),
     |                             ^
  28 |          typeof classes.li === 'string' ? classes.li : classes.li?.(node)
  29 |        )}

Reproduction

See this repo for an example.
Clone -> Run pnpm install -> cd into packages/svelte-ux -> pnpm dev
Experiance the fun!

Logs

/home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/TreeList.svelte:25:53 Internal compiler error: let directive at invalid position. Please report this to https://github.com/sveltejs/svelte/issues
/home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/TreeList.svelte:25:53 Internal compiler error: let directive at invalid position. Please report this to https://github.com/sveltejs/svelte/issues (x2)
11:25:34 AM [vite-plugin-svelte] /home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/ToggleOption.svelte:34:0 A11y: Non-interactive element <label> should not be assigned mouse or keyboard event listeners.
11:25:34 AM [vite] Internal server error: /home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/TreeList.svelte:25:53 Internal compiler error: let directive at invalid position. Please report this to https://github.com/sveltejs/svelte/issues
  Plugin: vite-plugin-svelte
  File: /home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/TreeList.svelte:25:53
  25 |      <li
  26 |        class={cls(
  27 |          typeof theme.li === 'string' ? theme.li : theme.li?.(node),
     |                             ^
  28 |          typeof classes.li === 'string' ? classes.li : classes.li?.(node)
  29 |        )}
      at error (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/errors.js:569:8)
      at LetDirective (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/3-transform/client/visitors/template.js:2766:4)
      at next (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:106:21)
      at _ (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/scope.js:666:4)
      at visit (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:100:13)
      at Object.visit (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:86:20)
      at serialize_inline_component (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/3-transform/client/visitors/template.js:748:66)
      at SvelteSelf (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/3-transform/client/visitors/template.js:2730:21)
      at next (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:106:21)
      at _ (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/scope.js:666:4)
11:25:36 AM [vite] Internal server error: /home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/TreeList.svelte:25:53 Internal compiler error: let directive at invalid position. Please report this to https://github.com/sveltejs/svelte/issues
  Plugin: vite-plugin-svelte
  File: /home/kevin/source/repos/opensource/svelte-ux/packages/svelte-ux/src/lib/components/TreeList.svelte:25:53
  25 |      <li
  26 |        class={cls(
  27 |          typeof theme.li === 'string' ? theme.li : theme.li?.(node),
     |                             ^
  28 |          typeof classes.li === 'string' ? classes.li : classes.li?.(node)
  29 |        )}
      at error (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/errors.js:569:8)
      at LetDirective (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/3-transform/client/visitors/template.js:2766:4)
      at next (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:106:21)
      at _ (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/scope.js:666:4)
      at visit (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:100:13)
      at Object.visit (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:86:20)
      at serialize_inline_component (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/3-transform/client/visitors/template.js:748:66)
      at SvelteSelf (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/3-transform/client/visitors/template.js:2730:21)
      at next (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/zimmerframe@1.1.0/node_modules/zimmerframe/src/walk.js:106:21)
      at _ (file:///home/kevin/source/repos/opensource/svelte-ux/node_modules/.pnpm/svelte@5.0.0-next.15/node_modules/svelte/src/compiler/phases/scope.js:666:4) (x2)

System Info

Linux Mint
Brave Browser

Severity

blocking an upgrade

@dummdidumm
Copy link
Member

See which repo? There's no link to a repository.
Please just copy-paste the full content of that TreeList.svelte file into this issue, that should be enough.

@7nik
Copy link

7nik commented Nov 30, 2023

I believe this is a simplified version.

@techniq
Copy link

techniq commented Dec 1, 2023

Was coming here to open this issue, and I see it was already reported. Here is a minimal reproduction REPL (and working Svelte 4 REPL, although it looks like @Rich-Harris already has a PR fix 🎉.

Btw, the original TreeList was in Svelte UX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants