How to pass NODE_OPTIONS to the runtime?

Hello,
I have a NextJS project in typescript, that I start/build with standard next binary.
I’m trying to get sourcemaps mapping on stacktraces which requires to start node with the --enable-stack-traces option.

I tried two things that both don’t work:

  • Add a NODE_OPTIONS env variable to --enable-stack-traces
  • Modify the package.json entry like so:
  "scripts": {
    "start": "NODE_OPTIONS=\"--enable-source-maps\" next start",
  }

What am I missing?

Hey, Arnaud! Welcome to the Vercel Community :wave:

I asked v0 for some guidance here, and this is what it got back with → Next js source maps – v0 by Vercel

Hopefully that is helpful!

Hi,
Thank you for your help. I changed a few things to apply all changes suggested but I still don’t have sourcemap correspondance.