Skip to content

Incorrect source mapping pointing to a return token after minification #4180

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

Open
Andarist opened this issue May 10, 2025 · 1 comment
Open

Comments

@Andarist
Copy link

Code:

import { jsx } from "react/jsx-runtime";
import React from "react";
export function App() {
  const ref = React.useRef(null);
  React.useEffect(() => {
    console.log("ReplayAnalyze");
  }, []);
  return /* @__PURE__ */ jsx("div", { ref, children: "." });
}

Options:

--minify --sourcemap

Online repl: here

Visualized:

Image

I believe React shouldn't point to the return token here - despite that expression being inlined into the return statement after minification. This leads to weird sourcemapping issues, see my original report about this in the Vite's repo here: vitejs/vite#19819

@evanw
Copy link
Owner

evanw commented May 11, 2025

You're saying what you think shouldn't happen, but you haven't said what you think should happen. What would you like for esbuild to do here? What's the mapping that makes Chrome Developer Tools do what you want it to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants