How to debug NextJS during the build phase

Viewed 2260

My nextJS app have a path with 50k plus pages. Running with npm run dev it works fine, but during build it gives me an error TypeError: Cannot read property 'page' of undefined at exportPaths.filter.route That is weird, because I know how many paths I am trying to do (56,427) and they are fine. I would really like to see where I messed up, but I can't launch a debugger for build stage ending with 'Starting inspector' multiple messages. I have tried other ways, but with no success.

Here is my config, which is pretty obsolete, but seems straightforward:

{
            "type": "node",
            "request": "launch",
            "name": "Next: Node",
            "runtimeExecutable": "${workspaceFolder}/node_modules/next/dist/bin/next",
            "env": {
                "NODE_OPTIONS": "--inspect"
            },
            "args": ["build"],
            "port": 9229,
            "console": "integratedTerminal"
        }

P.S. Debugging npm run dev works fine P.P.S. trying to 'listen' to the debugger in VS Code and launching debugger from command line, like in here https://nextjs.org/docs/advanced-features/debugging gives me the same problems.

0 Answers
Related