Skip to content

__NO_SIDE_EFFECTS__ does not support functions from outside modules #4369

@ocavue

Description

@ocavue

Given the following input

// main.js
import { g } from './g.js';

/* @__NO_SIDE_EFFECTS__ */
function f(a) { console.log('function_f' + a) }

function h(a) { console.log('function_h' + a) }

f('removeThisCall_1')
g('removeThisCall_2')
h('keepThisCall_3')
// g.js
/* @__NO_SIDE_EFFECTS__ */
function g(a) { console.log('function_g' + a) }

export { g }

I expected g('removeThisCall_2') to be removed in the final output, but esbuild still keeps it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions