question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

esbuild fails on `Generating static pages` step in serverless Next.js applications

See original GitHub issue
  • mdx-bundler version: 3.1.2
  • node version: any (tried 12, 14, and 15.12)
  • npm version: 7.6.3

Relevant code or config: repl.it of bug

What you did: Added target: "serverless" to a next.js project with mdx-bundler

What happened: image

Reproduction repository: https://replit.com/@TheoBr/mdx-bundler-static-demo#README.md

Problem description: Seems to be an issue with how esbuild is run in next.js’s serverless path. Not functionality I’m super familiar with, I just know that netlify forces it to be enabled. (fwiw I’ve had no issues using this with vercel (see: tt.fm)

Suggested solution: Bug EvanW or Guillermo maybe? I’m lost on this one

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
Arcathcommented, Mar 26, 2021

@kentcdodds I was thinking the same thing.

I was thinking this is all it would need:

if(__dirname === "" && !process.env.ESBUILD_BINARY_PATH){
  //FIX
}

That way we fix it if we need to and don’t interferrer with anyones overrides

2reactions
kentcdoddscommented, Mar 26, 2021

You know what… The more I think about this, the more I think we should probably support this out of the box 🤔 We know where the esbuild binary should be, so we can set that env variable ourselves if it’s not already set.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content Types - ESBuild
Each content type has an associated "loader" which tells esbuild how to interpret the file contents. Some file extensions already have a loader...
Read more >
serverless AWS deployment fails because of esbuild
When I try to deploy my serverless application to AWS I'm running into this error: I'm using the aws-nodejs-typescript template.
Read more >
Serverless SSR with React 18 and NextJS 12 in AWS
The next step is to create a CloudFront distribution to cache and forward requests to either the AWS Lambda or to the S3...
Read more >
Build functions - Netlify Docs
Create functions source files in TypeScript, JavaScript, and Go. ... To add a serverless function to your project, create a TypeScript file in...
Read more >
Next.js - Full Context Review
Then continue with the main structure of a Next.js application. ... server rendered- and incrementally generated static pages.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found