Closed zaiste closed 3 years ago
Thanks for the report! We're talking about ways to improve the esbuild binary detection amongst the team.
Would you be able to share a path to the binary without adding esbuild
directly? That would be helpful!
Thanks!
Thanks for your work on this fantastic package!
Right now the binary could be found at /node_modules/.pnpm/esbuild@0.11.18/node_modules/esbuild/bin
, but there is a related discussion over at PNPM (cf. https://github.com/pnpm/pnpm/discussions/3191) to provide a more general support. It's not a big issue, this could wait till pnpm supports it.
~I was able to workaround this by following related guidance from an alternative to this project: https://github.com/kentcdodds/mdx-bundler#nextjs-esbuild-enoent.~
~TL;DR: Add something like this before you call serialize
:~
Edit: Sorry, I didn't realize the nuances of the issue, so this workaround was only necessary for me because my Next.js app is located in a monorepo directory (my actual usage of the snippet above replaced process.cwd()
with (effectively) process.cwd()/../..
), so the baked in helper linked below doesn't quite work. I'm not actually using pnpm
, and mistakenly thought the workarounds were related.
@kylegach We actually do have something like that baked in 😅 https://github.com/hashicorp/next-mdx-remote/blob/main/src/serialize.ts#L11-L38
I am working in a monorepo and esbuild is installed in the top-level node_modules
directory. It seems like the logic baked into next-mdx-remote
only checks the most immediate node_modules
directory (understandable). I wonder if there's any better solution than manually modifying that path to point to the right place.
@zaiste Could you try to upgrade to the latest version and see if that resolves your issue? We made some improvements to the esbuild binary resolution and I'm hoping it might help here as well.
@BRKalow it works now without adding esbuild
explicitly. Thank you!
When using
pnpm
theesbuild
binary cannot be located, i.e.Adding
esbuild
directly to project'spackage.json
solves the problem.