I want to get a deeper knowledge about Next.js internals, however, I have a problem with setting up an appropriate Node.js debug configurations on /examples/hello-world.
To do so I took the following steps:
examples/hello-worldnpm install --save-dev babel-clipackage.json to the following one"dev": "babel-node --debug --presets es2015 ../../bin/next",
require('babel-register') to /bin/next-dev, but still it throws the following error:C:\Code\temporary\next.js\bin\next-dev:3
import { resolve, join } from 'path'
^^^^^^
SyntaxError: Unexpected token import
Do you know what might be the reason?
How do you debug Next.js internals when running an exemplary project?
I wrote on Slack regarding this, but no response. In advance, thanks a lot for help. It is really important for me to debug properly in order to help you resolving any bugs, in case of free time :)
There's no way to debug using node --debug. Cause there are no sourcemaps and all ran code is transpiled. When you want to debug it's best to just use plain old console.log. Cause it's a combination of client/server rendering only debugging the node.js side wouldn't suffice either way :). If you're looking for issues that can help you understand the codebase take a look at the good for beginners label https://github.com/zeit/next.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+for+Beginners%22
I am considering using Next.js in production, so I'd like to be able to debug internals easily without using console.log. Of course, debugging client and server side should be done separately.
The whole project is run in Node.js, so there should be an option to debug server side.
What about adding sourcemaps?
Most helpful comment
I am considering using Next.js in production, so I'd like to be able to debug internals easily without using
console.log. Of course, debugging client and server side should be done separately.The whole project is run in Node.js, so there should be an option to debug server side.
What about adding sourcemaps?