Nextjs: how to debug production locally because development is working perfectly

190 Views Asked by At

My nextjs setup is running perfectly in development. When do a build, all is building as it should. But when we serve production locally we get

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

Now, I know that it's probably because of a mixup of named imports or something but since it's such a large application, isn't there a way to debug production locally?

I already saw the documentation regarding NODE_OPTIONS='--inspect'

thanks!

1

There are 1 best solutions below

0
On

To check either your project working fine in production or not:

  1. Build the project using this command

    npm run build

  2. If any error occurs, the build command will fail. If the build command is successfully ran, you can check the project in production mode using this command:

    npm run start