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
Build dependencies failed at import and can't resolve 'path' #129
Comments
Hi @brunowego! Thanks for opening this issue. Please provide a link to a reproduction repository. 🙏 |
Hi @schickling, thanks for you quick reply. Sure, take a look here https://github.com/brunowego/issue-reproduction/tree/next-contentlayer-129 |
I'll take a more in-depth look next week when I'm working on Contentlayer again but in the meanwhile you can try to change this line https://github.com/brunowego/issue-reproduction/blob/next-contentlayer-129/next.config.mjs#L10 to export default withContentlayer()(nextConfig) |
@brunowego I've just given the repo you posted a try and it seems to work for me. Is there still a problem? |
Hi @schickling, yes, nothing changed. Using NPM or Yarn commands got the same issue. Versions:
|
I unfortunately can't reproduce the problem with the repo you shared. Can you please try to delete |
Thanks a lot for your time! I really understand that is hard to reproduce this error. Yes, I removed the both folders and the warning continues. |
I'm getting this error as well on the latest It also occurs on: Relevant versions: "contentlayer": "^0.1.2",
"convertkit-react": "^1.5.5",
Did you find/fix this error, by chance? |
@auser thanks for your comment. Would you please mind posting a link to your repo with instructions how to reproduce this problem? |
Same issue here. The problem occurs when using a Reproduction here: https://github.com/mshick/newnewsite |
I'll add, I get an additional error on startup which I've pasted below. I've removed
|
I'm also getting pretty much the same warnings in logs when using with See logs
|
I've taken a deeper look into this issue and the provided repro (thanks @mshick). Here is what I've found:
It seems like the original issue was related to the usage of the Next.js plugin and was by @brunowego by using To avoid other users potentially running into this problem I'm planning to introduce this API change for the Next.js plugin: #140 (Feedback wanted!)
Additionally to the original problem (see (1)) there seems to be another problem (which technically is only a "warning") which isn't a problem in Contentlayer itself but rather a bug in Next.js / Webpack (see vercel/next.js#33693) when using If you don't want to wait until this problem is addressed in Next.js, please use Given (1) was successfully solved and (2) is an external problem with known workaround, I'll close this issue. If there are any further problems related to this, please provide further context in the comments or on Discord. |
Example const { withContentlayer } = require("next-contentlayer");
module.exports = withContentlayer(); |
Still getting this error. This is my MDX: ---
author: luc-gagan
description: "Playwright logos and brand assets for press and media use."
guid: 0189174d-eed1-78d6-ae06-1a117062f130
publishedAt: 2023-07-02T15:52:03.773Z
slug: playwright-logo
tags: [playwright, playwright-test]
title: "Playwright logos and brand assets"
altTitle: "Press & media resources"
---
import { BrandAssets } from '../components/BrandAssets.tsx'; My next config is already wrapped with What could be off? |
same error,how to fix it? |
Also receiving the same error as @lucgagan |
So since ContentLayer doesn't work correctly with ESM/next.config.mjs, that means it's incompatible with the plaiceholder package, which requires ESM/next.config.mjs. Shame. I hope this is resolved at some point. |
I also having the same issue here like saying - |
@schickling appears this was closed without resolution |
For what it is worth, migrating the entire project back to commonjs makes the issue go away. |
I have been tryna solve the problem from my side also. But first I wanted to understand what could be the issue. Client side and server sideSince contentlayer compiles or renders or whatever it does, it does it on the server side, not the client side. I am using NextJS version 14 with TypeScript. When I use "use client", I get this error. But when it is a server component, I do not get the error. A way to solve the problemIf you are using the useMDXComponent and you are overriding your components, there you can customize the elements with client side components. some content here
<comp prop={any} /> Then I added the new "element" to my customized components, like this: ...
comp: ({...props }) => (
<ClientSideComponent
props={props}
/>
) Here is how your client side will look like: "use client";
import React from "react";
export default function ClientSideComponent({ props }: {props: {[x: string]: any;}}) {
return (
...jsx
)
} So instead of using your client side component directly on the import ClientSideComponent from "../path/ClientSideComponent";
Some conent
<ClientSideComponent /> You just use the way I showed. The code is type safe if you are using TypeScript. Hope this helps, if it does not, no worries your a re programmer, you will figure it out 🥴. |
I'm new here. Thanks for this awesome project! So, currently I'm getting this issue, I'm invested time to solve, but without success. Any help is welcome.
Package versions:
The text was updated successfully, but these errors were encountered: