-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Describe the bug
swc only evaluates one check for some reason.
let n,
hooks,
isHydrating = !1;
isHydrating = !0;
let localDeps = '',
localDepsCnt = 0,
injectDependency = (c) => (
isHydrating || (localDeps += c + ','), localDepsCnt++
);
let logID = isHydrating ? '' : injectDependency(
'() => console.log("ID:", +Math.random().toFixed(2))',
);
// isHydrating is not evaluated
// If logID2 is commented out it evaluates isHydrating and tree shake injectDependency as expected
let logID2 = isHydrating ? '' : injectDependency(
'() => console.log("ID:", +Math.random().toFixed(2))',
);
Input code
Config
Link to the code that reproduces this issue
SWC Info output
No response
Expected behavior
// Empty file
Actual behavior
let isHydrating = !1;
isHydrating = !0;
let localDeps = '', localDepsCnt = 0, injectDependency = (c)=>(isHydrating || (localDeps += c + ','), localDepsCnt++);
isHydrating || injectDependency('() => console.log("ID:", +Math.random().toFixed(2))'), isHydrating || injectDependency('() => console.log("ID:", +Math.random().toFixed(2))');
Version
1.13.5
Additional context
No response