Open ozgurozalp opened 4 months ago
Assuming the project works locally? Also, what Node.js version are you running in Vercel and is the repo public where I could take a look?
Assuming the project works locally? Also, what Node.js version are you running in Vercel and is the repo public where I could take a look?
Yes, it works locally.
Thanks for providing a repo! Sorry, I haven't had a chance to look into this deeper. Are the versions of Node.js locally and in Vercel the same? Off the top of my head, I'm not sure why the TypeScript compiler can't find those specifically in Vercel 🤔
I'm also having this issue, it seems like Next.js automatically "removes" unnecessary files & folders, in this case - the root blog
folder once the build process completes. If you go in to one of your development history on Vercel, click on source, then output, there is no original files being preserved.
Btw: you can also build on your local machine and inspect the .next
folder, in the server
folder, there blog
folder only contains the SSG-ed file and paths. Meaning the original files were not included.
I'm still looking for ways to figure out how to solve this issue. In the meantime, use SSG to prebuild your blog pages as static files. Then we need to "ignore" allBlog.get()
method on Vercel so it won't cause error (as all pages are now static).
I'm also having this issue, it seems like Next.js automatically "removes" unnecessary files & folders, in this case - the root
blog
folder once the build process completes. If you go in to one of your development history on Vercel, click on source, then output, there is no original files being preserved.Btw: you can also build on your local machine and inspect the
.next
folder, in theserver
folder, thereblog
folder only contains the SSG-ed file and paths. Meaning the original files were not included.I'm still looking for ways to figure out how to solve this issue. In the meantime, use SSG to prebuild your blog pages as static files. Then we need to "ignore"
allBlog.get()
method on Vercel so it won't cause error (as all pages are now static).
Update:
I moved the root blog
folder into app/
folder and renamed it as _blog
. Then I changed the config as follows:
before:
import { createSource } from "mdxts";
export const allBlog = createSource("**/*.mdx", {
baseDirectory: "blog",
basePathname: "/blog",
sort: (a, b) => b.frontMatter.date.localeCompare(a.frontMatter.date),
});
After:
import { createSource } from "mdxts";
export const allBlog = createSource("**/*.mdx", {
baseDirectory: "_blog", // <-- Change this
basePathname: "/blog",
sort: (a, b) => b.frontMatter.date.localeCompare(a.frontMatter.date),
});
I have not seeing Vercel log errors ✨
Can you try if this helps?
@fluid-design-io thank you for looking into this! This makes much more sense now, I didn't realize this happened when it wasn't static. This might be fixed by specifying the directory with outputFileTracingRoot in your next config.
I'm hitting the issue in a similar fashion. Problem basically being: the library expects all files to be there but they aren't. No way of fiddling with the options seems to work or include any of the files
I feel like ultimately the way renoun is interaction with bundlers isn't sufficient right now. It seems like fs
apis are being used, which go outside a bundler, and make deploying with next a real pain.
@hipstersmoothie what version are you on? Assuming you are targeting files outside of the workspace? I still haven't run into this personally. Not sure why it hasn't been an issue for me. In Vercel's project settings I have this option checked:
I get this error in vercel FileNotFoundError: File not found: /vercel/path0/blog/{WHAT_EVER}.mdx
FileNotFoundError: File not found: /vercel/path0/blog/gunluk-meditasyonun-faydalari-ve-uygulama-yontemleri.mdx at DirectoryCoordinator.addSourceFileAtPath (/var/task/node_modules/ts-morph/dist/ts-morph.js:19088:19) at Project.addSourceFileAtPath (/var/task/node_modules/ts-morph/dist/ts-morph.js:20551:51) at /var/task/.next/server/chunks/73.js:33:45040 at Array.forEach (<anonymous>) at Q (/var/task/.next/server/chunks/73.js:33:44893) at m (/var/task/.next/server/chunks/73.js:30:36103) at /var/task/.next/server/app/[slug]/page.js:1:4398 { path: '/vercel/path0/blog/gunluk-meditasyonun-faydalari-ve-uygulama-yontemleri.mdx', code: 'ENOENT', page: '/gunluk-meditasyonun-faydalari-ve-uygulama-yontemleri2' }