rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Support side-effects-free JSX runtime

Open cometkim opened this issue 2 years ago • 0 comments

Currently the compiler treats modules using JSX are not pure modules.

In common use cases, like in React, the JSX runtime can be treated as pure, and safe DCE can be expected via adding the /* @__PURE__ */ annotation.

To support this, we can add the jsx.sideEffects boolean option.

Since not all JSX runtimes are safe for this, we still leave the default value as true. users can change the option false to force the bundler to perform a more aggressive DCE.

Prior art

https://esbuild.github.io/api/#jsx-side-effects

cometkim avatar Nov 05 '23 21:11 cometkim