From 4befd8f3185dcab90ebe47a40f9ddd8bb2a46a66 Mon Sep 17 00:00:00 2001 From: Andri Schatz Date: Wed, 27 Nov 2024 14:45:12 +0100 Subject: [PATCH] Update svelte.config.js to properly handle TypeScript TypeScript syntax inside the script tags of SvelteKit routes and components isn't properly handled without adding vitePreprocess, crashing the application. With vitePreprocess, it works. --- .../svelte/src/__frontend_name__/svelte.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dfx/assets/project_templates/svelte/src/__frontend_name__/svelte.config.js b/src/dfx/assets/project_templates/svelte/src/__frontend_name__/svelte.config.js index 0d8c6762d0..f160978948 100644 --- a/src/dfx/assets/project_templates/svelte/src/__frontend_name__/svelte.config.js +++ b/src/dfx/assets/project_templates/svelte/src/__frontend_name__/svelte.config.js @@ -1,7 +1,9 @@ import adapter from '@sveltejs/adapter-static'; +import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; /** @type {import('@sveltejs/kit').Config} */ const config = { + preprocess: vitePreprocess(), kit: { // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. // If your environment is not supported or you settled on a specific environment, switch out the adapter.