plugins icon indicating copy to clipboard operation
plugins copied to clipboard

[plugin-replace] @rollup/[email protected] doesn't work when ternary operator is used and preventAssigment is true

Open EAGzzyCSL opened this issue 2 years ago • 1 comments

  • Rollup Plugin Name: @rollup/plugin-replace
  • Rollup Plugin Version: 3.7.5(unrelated)
  • Rollup Version: 5.0.5(important)
  • Operating System (or Browser): Mac OS(unrelated)
  • Node Version: v18.18.0(unrelated)
  • Link to reproduction (⚠️ read below): https://stackblitz.com/edit/rollup-case-unexpected-replace (run npm build)

Expected Behavior

dist/main.js will be

console.log(Math.random() > 0.5? 123: 456);

Actual Behavior

dist/main.js is

console.log(Math.random() > 0.5? FOO: 456);

Additional Information

EAGzzyCSL avatar Oct 30 '23 15:10 EAGzzyCSL

@hhgnsc this is a regression from the last PR. (we didn't have a test for this, so it's not your fault no worries)

shellscape avatar Oct 30 '23 15:10 shellscape