vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.86k stars 26.66k forks source link

Nextjs + SWC produces null __debugSource/_debugInfo #66965

Open givo opened 2 months ago

givo commented 2 months ago

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
    }
  3. 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;
  4. Run npm run dev

Current vs. Expected behavior

Expected:

Actual

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

leerob commented 1 month ago

I'm a little confused: