Build fails for SvelteKit vercel adapter
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 - https://github.com/vercel/vercel/discussions/8726.
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.
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;
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.
Closing due to inactivity. Also, this issue can probably be fixed by using the new __ENABLE_CARTA_SSR_HIGHLIGHTER__ flag.
I'm also having problems deploying to vercel. I'm not using the edge runtinme for the route using Carta.
Tried setting the ENABLE_CARTA_SSR_HIGHLIGHTER, but it made no difference.
The error I'm getting is: error during build: Error: Could not load /vercel/path0/regex/dist/regex.js (imported by node_modules/.pnpm/[email protected]/node_modules/oniguruma-to-js/dist/index.mjs): ENOENT: no such file or directory, open '/vercel/path0/regex/dist/regex.js'
@martinjo you should open a new issue for that. I'm not able to look into that at the moment, but I was able to succesfully deploy to vercel myself.