-
Notifications
You must be signed in to change notification settings - Fork 27.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings when debugging in VS Code #24349
Comments
Looks like we are generating all the required source maps in the react-refresh-utils package, but they're not included in the published package/tarball. @timneutkens We could add |
Hi, @breyed— Do the following VS Code launch configurations added to documentation in #28815 help at all? {
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "pwa-chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"console": "integratedTerminal",
"serverReadyAction": {
"pattern": "started server on .+, url: (https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}
]
} These may need some fiddling if the root of your app is at |
THANK YOU @TyMick ! I have spent centuries trying to debug nextjs via vscode. I dub thee |
ok, I take it back. i still wana be friends. Help me, @TyMick , you're my only hope... |
I have the same problem of @Pickra. Seems like it's a nextjs have bug to debug server side. No way to debug server side. I have followed the official docs but no success |
Anything further on this? same issue, same config from the docs |
finding this same issue as well with nextjs' new release 13,, it would be nice to debug in vscode with breakpoints |
@apollonian @Timer This issue still exists... can you please take a look at it? It is pretty distracting to see these warnings each time we refresh a client under debug. |
on the server side, maybe you need to settle breakpoints before |
Hey all! After 2 days spent copying and pasting and not very wisely barely reading documentation (lol, won't happen next time), I have a hacky way to debug fully from VSCode, client and server side. My launch.json is
Straightforward, it launchs Chrome and vscode by default attaches the server-side-working (doesn't work for client side for me) debugger to it. It also prints in your console client side logs, which without this config it didn't. NextJS shouldn't have in https://nextjs.org/docs/pages/building-your-application/configuring/debugging outdated recommendations: "debugWithChrome" uses Debugger for Chrome which has been deprecated for a long time. Now VSCode uses the extension JavaScript Debugger and automatically will debug your launched process (although several node processes are actually launched and that's why autoAttachChildProcesses can be useful). OK, so this is not the actual fix, just side notes about what I learned. The hacky solution to client side code breakpoints being useless is using the reserved word |
Yikes, this issue is growing old. 🙁 I was expecting there to be LEAST COMPLICATED
|
It's 2024 and I still have no idea how to debug server side code in NextJS.
As a test, I created a new NextJS project, added a new dummy route, added I feel like I have to be missing something obvious. Surely debugging works in Next 14 and surely the default new project scaffolding supports it? |
Sporadically I am able to get it to debug server side code but it's recently gotten less consistent. Files under the directory The file I'm working in has
I was able to fix this issue by implementing the /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
// ESLint Configuration
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
eslint: {
// Run ESLint on these directories during the build process
dirs: ['app', 'components', 'layouts', 'scripts'],
// Ensure ESLint runs in development and fails the build on errors
ignoreDuringBuilds: false,
},
images: {
minimumCacheTTL: 604800,
domains: [
'm.media-amazon.com',
],
},
// Additional Next.js configurations can be added here
webpack(config) {
Object.defineProperty(config, 'devtool', {
get() {
return 'source-map';
},
set() {},
});
return config;
},
}
module.exports = nextConfig It will give a warning that it has reverted the webpack devtool but in effect it seems to have fixed the issue. Warning: Reverting webpack devtool to 'eval-source-map'.
Changing the webpack devtool in development mode will cause severe performance regressions.
Read more: https://nextjs.org/docs/messages/improper-devtool |
@Apezdr are you using --turbo here? |
My command for running the server didn't have any special commands like that. I am pretty sure not. |
@Apezdr's fix worked for me on |
What version of Next.js are you using?
10.1.3
What version of Node.js are you using?
v14.16.1
What browser are you using?
Safari
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
Debugging a starter Next.js installation shows several warnings. Even if they are benign, they make it hard to notice other warnings that may appear as the project is developed.
VS Code shows the following on the Debug Console:
Expected Behavior
No warnings.
To Reproduce
npx create-next-app nextjs-test --use-npm
packages.json
inscripts
:"debug": "NODE_OPTIONS='--inspect' next dev",
..vscode/launch.json
with:npm run debug
Debug: Start Debugging
.The text was updated successfully, but these errors were encountered: