Unexpected token '{' when building SvelteKit app for Cloudflare Pages

16 Views Asked by At

I'm attempting to deploy my test SvelteKit app on Cloudflare Pages. It's a very simple app with just two pages, but I've already encountered an error, and I'm not sure how to resolve it. My suspicion is that TypeScript is not being recognized inside the .svelte files...

16:41:44.832    vite v4.4.9 building SSR bundle for production...
16:41:44.871    transforming...
16:41:44.949    ✓ 5 modules transformed.
16:41:44.952    ✓ built in 114ms
16:41:44.952    [vite-plugin-svelte] /opt/buildhome/repo/src/routes/r1/+page.svelte:2:13 Unexpected token
16:41:44.952    file: /opt/buildhome/repo/src/routes/r1/+page.svelte:2:13
16:41:44.952     1 |  <script lang="ts">
16:41:44.952     2 |    import type { PageData, ActionData } from './$types';
16:41:44.952                        ^
16:41:44.952     3 |    import { enhance } from '$app/forms';
16:41:44.952     4 |    export let data: PageData;

I try to find similar solved questions but without any luck.

0

There are 0 best solutions below