The spec does not clarify whether #__NO_SIDE_EFFECTS__
applies to new expressions and tagged templates.
/* #__NO_SIDE_EFFECTS__ */ function foo() { console.log('foo') }
new foo()
foo``
Tool |
new expr |
tagged templ |
playground |
Rollup |
✅ |
✅ |
link |
esbuild |
❌ |
✅ |
link |
SWC |
❌ |
✅ |
link |
Oxc |
✅ |
❌ |
link |
✅: removes the expression
❌: does not remove the expression
Currently, the behaviors are not aligned.