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? #507

Closed
joergrech opened this issue Jul 7, 2023 · 3 comments
Closed

Version 0.3.4 Broken on Vercel? #507

joergrech opened this issue Jul 7, 2023 · 3 comments
Labels
help wanted Extra attention is needed meta: stale

Comments

@joergrech
Copy link

As I'm using next-contentlayer this is a crosspost (shadcn/next-contentlayer#11) but I hope some here had a similar problem and can give me a hint:

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?

@huanfe1
Copy link

huanfe1 commented Jul 12, 2023

Same problem.

I change build to contentlayer build & next build, It seem to resolve.

@yunsii
Copy link

yunsii commented Jul 16, 2023

Same problem.

I change build to contentlayer build & next build, It seem to resolve.

Use prebuild script alternatively:

{
  "prebuild": "contentlayer build",
  "build": "next build",
}

@schickling schickling added the help wanted Extra attention is needed label Jul 17, 2023
rlj1202 added a commit to rlj1202/blog that referenced this issue Aug 11, 2023
@stale
Copy link

stale bot commented Sep 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale label Sep 16, 2023
@stale stale bot closed this as completed Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed meta: stale
Projects
None yet
Development

No branches or pull requests

4 participants