Vercel can't find modules
Unanswered
Silver carp posted this in #help-forum
Silver carpOP
Can't deploy on Vercel has it is unable to find the modules. Any idea why this may be happening? No errors when running locally.
2 Replies
@Silver carp Can't deploy on Vercel has it is unable to find the modules. Any idea why this may be happening? No errors when running locally.
Dutch Smoushond
is there errors for other files also in the getting started directory
@Dutch Smoushond is there errors for other files also in the getting started directory
Silver carpOP
hey! ended up finding a solution, though im not sure what exactly fixed it. i used
dynamic()
(im donig dynamic imports) and removed the one time variable (for some reason it wasnt building)// good - builds
export async function getMarkdown(chapter: string, article: string) {
const fileContent = dynamic(async () => await import(`@/docs/${chapter}/${article}.mdx`));
return fileContent;
}
// bad - does not build
export async function getMarkdown(chapter: string, article: string) {
const filePath = `@/docs/${chapter}/${article}.mdx`;
const fileContent = dynamic(async () => await import(filePath));
return fileContent;
}