Skip to content

Clarify the behavior when the #__NO_SIDE_EFFECTS__ comment is put before a parenthesis #11

@sapphi-red

Description

@sapphi-red

The spec does not clarify when #__NO_SIDE_EFFECTS__ comment is put before a parenthesis (it is explicitly allowed for #__PURE__).

var myVariable = /*#__NO_SIDE_EFFECTS__*/ (function() {
  // Function code here
});

/*#__NO_SIDE_EFFECTS__*/
const sideEffectFreeVariable = (() => {
  // Function code here
});
Tool result playground
Rollup link
esbuild link
SWC link
Oxc ❌ (will be changed to ✅ by oxc-project/oxc#17711) link

✅: removes the expression
❌: does not remove the expression

Currently, the behaviors are not aligned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions