-
-
Notifications
You must be signed in to change notification settings - Fork 613
Closed
Labels
Description
- Rollup Plugin Name: @rollup/plugin-commonjs
- Rollup Plugin Version: 26.0.1
- Rollup Version: 4.22.4
- Operating System (or Browser): MacOS (Edge)
- Node Version: 18
- Link to reproduction (
⚠️ read below): https://stackblitz.com/edit/rollup-repro-wfhzr4?file=rollup.config.mjs
Expected Behavior
All reachable CJS exports (i.e. exports.foo = bar) are transformed.
Actual Behavior
A reachable CJS export remains in the true branch:
/* dist/index.mjs */
if (globalThis.crypto || false) {
// 👇
exports.getRandomValue = () =>
globalThis.crypto.getRandomValues(new Uint8Array(1))[0];
} else {
lib.getRandomValue = () => {
throw Error();
};
}Additional Information
This happens when appending || false to the condition in the if statement.