plugins
plugins copied to clipboard
[plugin-replace] @rollup/[email protected] doesn't work when ternary operator is used and preventAssigment is true
- 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
-
@rollup/[email protected]works - the option
preventAssigmentof@rollup/[email protected]should be settruefor reproduction
@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)