So I wanted to add MDSVEX to my sveltekit project. It works great when trying it locally on my machine. But I get the following error when deploying my code to vercel:
Error: Could not load /vercel/path0/src/lib/Instructions.md (imported by src/routes/+page.svelte): ENOENT: no such file or directory, open '/vercel/path0/src/lib/Instructions.md'
Error: Command "npm run build" exited with 1
Deployment completed
BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1
Here is my code
mdsvex.config.js:
import { defineMDSveXConfig as defineConfig } from 'mdsvex';
const config = defineConfig({
extensions: ['.svelte.md', '.md', '.svx'],
smartypants: {
dashes: 'oldschool'
},
remarkPlugins: [],
rehypePlugins: []
});
export default config;
svelte.config.js:
import adapter from '@sveltejs/adapter-auto';
import { mdsvex } from "mdsvex";
import mdsvexConfig from './mdsvex.config.js';
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: [".svelte", ...mdsvexConfig.extensions],
kit: {
adapter: adapter()
},
preprocess: [mdsvex(mdsvexConfig)]
};
export default config;
+page.svelte:
<script>
import Instructions from '$lib/Instructions.md';
</script>
<Instructions />
What is the problem here?