Skip to content
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

Nextjs + SWC produces null __debugSource/_debugInfo #66965

Open
givo opened this issue Jun 17, 2024 · 0 comments
Open

Nextjs + SWC produces null __debugSource/_debugInfo #66965

givo opened this issue Jun 17, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc. SWC Related to minification/transpilation in Next.js.

Comments

@givo
Copy link

givo commented Jun 17, 2024

Link to the code that reproduces this issue

https://github.com/vercel/next-learn/tree/main/dashboard/final-example

To Reproduce

  1. Clone next-learn dashboard repo from nextjs-learn
  2. set .swcrc to (optional - with or without this has no affect):
{
  "jsc": {
    "target": "es2021",
    "parser": {
      "syntax": "typescript",
      "tsx": true
    },
    "transform": {
      "react": {
        "runtime": "automatic",
        "development": true,
        "refresh": true
      }
    }
  },
  "sourceMaps": true,
  "minify": false
}
  1. set next.config.mjs to (optional - with or without this has no affect):
/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack(config, { dev }) {
    config.mode = 'development';
    config.devtool = 'source-map'; // nextjs automatically converts this to eval-source-map
    return config;
  },
  reactStrictMode: true,
  swcMinify: false,
  productionBrowserSourceMaps: true,
};
module.exports = nextConfig;
  1. Run npm run dev

Current vs. Expected behavior

Expected:

  • fiber nodes of React components should have _debugInfo with file name and line number

Actual

  • _debugInfo is null

Provide environment information

React: 18.3.1
Nextjs: 14.2.4
Node: 20.13.1
Operating system: Mac 14.2.1

Which area(s) are affected? (Select all that apply)

Developer Experience, SWC

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

  • As described here it used to work.
  • I would also want to have _debugInfo in server side components, is it even possible?
  • I don't want to use babel because SWC is much faster and I'm also afraid that it won't be supported for much longer
@givo givo added the bug Issue was opened via the bug report template. label Jun 17, 2024
@github-actions github-actions bot added Developer Experience Issues related to Next.js logs, Error overlay, etc. SWC Related to minification/transpilation in Next.js. labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc. SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant