Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails for SvelteKit vercel adapter #54

Open
dit7ya opened this issue Apr 26, 2024 · 3 comments
Open

Build fails for SvelteKit vercel adapter #54

dit7ya opened this issue Apr 26, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@dit7ya
Copy link

dit7ya commented Apr 26, 2024

I am just trying out the v4 of this library in a SvelteKit project, but the build fails, probably due to this issue of shiki trying to load files using fs - vercel/vercel#8726.

@BearToCode BearToCode added the bug Something isn't working label Apr 26, 2024
@BearToCode
Copy link
Owner

Hello, can you provide some more details? Also, a simple example would be great. I'm also using the latest version inside of a Vercel project, and it's working fine.

@dit7ya
Copy link
Author

dit7ya commented Apr 26, 2024

Thanks for the prompt response. I dug a little deeper, and found out that it only breaks for the edge runtime of vercel.

import adapter from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';


const config = {

	preprocess: vitePreprocess(),

	kit: {
		adapter: adapter({runtime: 'edge'})
	}
};

export default config;

@BearToCode
Copy link
Owner

BearToCode commented Apr 27, 2024

It looks like the edge runtime only supports web APIs. From my little experience with it, you should use the edge runtime to handle requests that require fast responses near users, so probably you are accidentaly importing the component/Carta class in your +server.ts endpoint configured to use the edge runtime, as I don't see a reason you would import it there.

If, for some reason, you need to actually use it there, I honestly don't think there is a way for me to help you out, as the issue seems to be with Shiki. You might have better chances to have it fixed asking there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants