Feature request: config option for _not_ annonating JSX calls as PURE
Could esbuild add an option for turning off automatic JSX call /* @__PURE__ */ annotation?
I use a custom library powered by JSX. In the library the JSX calls have important side-effects, but the call results are not always used. Since esbuild marks all JSX calls with /* @__PURE__ */, minifiers/tree-shakers end up deleting JSX calls that shouldn't be deleted.
I realise the default makes sense for libraries like React, but I'm hoping JSX could have uses beyond them too!
Interesting, I think it has a workaround to manually keep jsx elements by wrapping with something that uses them, like - (minus):
- <div />;
esbuild --loader=jsx --jsx=automatic --tree-shaking
import { jsx } from "react/jsx-runtime";
-/* @__PURE__ */ jsx("div", {});
Huh. I was wondering if this would ever happen. I can add a setting for this.