esbuild
esbuild copied to clipboard
Incorrect source mapping pointing to a `return` token after minification
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:
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: https://github.com/vitejs/vite/issues/19819
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?
Closing this due to lack of a follow-up reply.