A developer is working on a Next.js project with TypeScript and wants to ensure that stack traces correctly map to source files using source maps. Since this requires running Node with the --enable-source-maps flag, they attempted two different methods but didn't achieve the expected results.
First, they tried setting the NODE_OPTIONS environment variable to include --enable-source-maps. Then, they modified the start script in package.json like this:
"scripts": {
"start": "NODE_OPTIONS=\"--enable-source-maps\" next start"
}
Source maps are still not functioning as intended in stack traces. Any ideas?