Summary
I need some guide on how to set up Sveltekit project that uses Typescript (With static adapter so it builds a public folder) while been able to have the api
folder (Serverless functions) using Typescript too.
For some reason each time I try this I hit issues and things don’t work as expected.
Is there any guide on how to set up this?
PS: I believe the main issue is that the tsconfig that a Sveltekit project needs isn’t compatible to the tsconfig that serverless functions in Typescript need (I could be wrong)
Example
No response
Steps to Reproduce
Using SvelteKit Template (GitHub - MrAmericanMike/create-svelte-template: Create Svelte Template) try to have an api
folder too and have everything work smoothly.
Current versus Expected behavior
api folder should work without any issues when using vercel dev independent on other project configurations
I set up this repository with what I have tried
If I rename api/random/index.ts
to api/random/index.js
everything works when I do vercel dev
However when the file has the .ts extension and I visit that api route, I get this error.
Error: Cannot read properties of undefined (reading 'startsWith')
Error: Function `api/random/index.ts` failed with exit code 1
Not sure how to solve this.