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

Version 0.3.4 Broken on Vercel? #11

Open
joergrech opened this issue Jul 6, 2023 · 3 comments · May be fixed by #13
Open

Version 0.3.4 Broken on Vercel? #11

joergrech opened this issue Jul 6, 2023 · 3 comments · May be fixed by #13

Comments

@joergrech
Copy link

I get the following error on Vercel during the build of a production server - however it works on my local machine in dev and prod mode.

./pages/api/blog.rss.ts:1:30
12:47:21.431 | Type error: Cannot find module '@/.contentlayer/generated' or its corresponding type declarations.
12:47:21.431 |  
12:47:21.431 | > 1 \| import { allBlogposts } from "@/.contentlayer/generated"
12:47:21.431

<br class="Apple-interchange-newline">

I used the "@/.contentlayer/generated" from Vercel's example https://github.com/shadcn/next-contentlayer/blob/main/app/page.tsx but even with "contentlayer/generated" it works on my machine but not vercel.

Btw. Visual Studio Code shows me a warn for "contentlayer/generated" (Cannot find module 'contentlayer/generated' or its corresponding type declarations.ts(2307)) - but as said running "yarn run dev" works fine.

I tried to add contentlayer dev before the build comman ("build": "contentlayer dev & next build") but that did not help either.

My package.json uses:
"next-contentlayer": "^0.3.3",
"contentlayer": "^0.3.3",
and yarn lock uses contentlayer in version 0.3.4

Any ideas how I can fix or debug this?

@nickzelei
Copy link

You need to change your build script to "build": "contentlayer build && next build"

@albertomenen
Copy link

Hello there! same problem here, but not working :(

@elizabetdev
Copy link

@albertomenen, as @nickzelei mentioned:

You need to change your build script to "build": "contentlayer build && next build"

This should fix the error. It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants