I have tried the same on different version of node (v18 and v20) but still end up with the same error. I am trying to "vite build" svelte and some of its components, namely @skeletonlabs/skeleton @skeletonlabs/tw-plugin. The repo can be accessed here Bundle-Svelte-Skeleton.
The error while running "npm run build" is:
x Build failed in 609ms
error during build:
ParseError: Unexpected token
- Did you forget to add lang="ts" to your script tag?
at error (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/utils/error.js:56:16)
at Parser.error (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/parse/index.js:143:3)
at Parser.acorn_error (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/parse/index.js:130:8)
at Object.read_script [as read] (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/parse/read/script.js:50:10)
at tag (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/parse/state/tag.js:203:27)
at new Parser (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/parse/index.js:91:12)
at parse (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/parse/index.js:268:17)
at Module.compile (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/[email protected]/node_modules/svelte/src/compiler/compile/index.js:136:14)
at compileSvelte (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/vite-plugin-svelte/src/utils/compile.js:147:22)
at async Object.transform (file:///home/kabiraatmonallabs/Skeleton_MeltUI/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/vite-plugin-svelte/src/index.js:152:20)