I am trying to use Shadcn-Svelte with my Svelte app and when trying to use components, I get errors from vite that seem like vite is interpreting Svelte scripts as JavaScript files, completely ignoring the lang="ts". My configuration files are correct, as they are unmodified from the svelte starter template.
I get errors along the lines of
[plugin:vite-plugin-svelte] .../frontend/src/lib/components/ui/input/input.svelte:2:13 Unexpected token
.../frontend/src/lib/components/ui/input/input.svelte:2:13
1 | <script lang="ts">
2 | import type { HTMLInputAttributes } from "svelte/elements";
^
3 | import type { InputEvents } from "./index.ts";
4 | import { cn } from "$lib/utils.ts";
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I am trying to use Shadcn-Svelte with my Svelte app and when trying to use components, I get errors from vite that seem like vite is interpreting Svelte scripts as JavaScript files, completely ignoring the
lang="ts"
. My configuration files are correct, as they are unmodified from the svelte starter template.I get errors along the lines of
Reproduction
bunx create svelte -> bunx shadcn-svelte init -> bunx shadcn-svelte add button
Steps to reproduce
shadcn-svelte
somewhere in Svelte (eg. `+page.svelte)bun dev
and go tolocalhost:5173
System Info
Used Package Manager
bun
Logs
No response
Validations