plugins icon indicating copy to clipboard operation
plugins copied to clipboard

[inject] doesn't transform references in object destructuring

Open eight04 opened this issue 3 years ago • 0 comments

  • Rollup Plugin Name: inject
  • Rollup Plugin Version: 4.0.4
  • Rollup Version: 2.77.2
  • Operating System (or Browser): Windows 10
  • Node Version: 17.4.0
  • Link to reproduction (⚠️ read below):

Repro: https://github.com/eight04/node-test/tree/rollup-inject-object-destruct source

export const foo = ({cwd = process.cwd()}) => {
  console.log(cwd);
};

config

inject({
  process: require.resolve("./shim/process")
})

Expected Behavior

The shim file should be included in the bundle.

Actual Behavior

The shim file was not included in the bundle.

Additional Information

It works fine if we don't use object destructuring:

export const foo = (cwd = process.cwd()) => {
  console.log(cwd);
};

eight04 avatar Aug 08 '22 18:08 eight04