You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// example 1
switch (test) {
case 1:
var hoisted = true;
case 2:
if (hoisted) console.log('Went also through case 1.');
}
// example 2
if (x) {
var h2 = true;
}
if (h2) console.log('x is true');
./bin/rollup --format cjs test.js
Expected Behavior
no tree shaking
Actual Behavior
'use strict';
// example 1
switch (test) {
case 1:
case 2:
console.log('Went also through case 1.');
}
console.log('x is true');
The text was updated successfully, but these errors were encountered:
nifgraup
changed the title
Regression: tree shaking wrong when variable hoisting is inside conditional statement
Regression: tree shaking wrong when var declaration + assignment is inside a conditional statement
Dec 20, 2018
nifgraup
changed the title
Regression: tree shaking wrong when var declaration + assignment is inside a conditional statement
Regression: tree shaking wrong when var declaration+assignment is inside a conditional statement
Dec 20, 2018
nifgraup
changed the title
Regression: tree shaking wrong when var declaration+assignment is inside a conditional statement
Regression: tree shaking wrong when var declaration+assignment is inside a conditional
Dec 20, 2018
lye
pushed a commit
to lye/rollup
that referenced
this issue
Dec 21, 2018
When hoisting a var, use UNKNOWN_EXPRESSION as the initializer instead
of the actual one. This prevents the initializer from being used during
the optimization step when it hasn't yet been assigned at runtime.
When hoisting a var, use UNKNOWN_EXPRESSION as the initializer instead
of the actual one. This prevents the initializer from being used during
the optimization step when it hasn't yet been assigned at runtime.
How Do We Reproduce?
test.js
./bin/rollup --format cjs test.js
Expected Behavior
no tree shaking
Actual Behavior
Regression point 187a256
The text was updated successfully, but these errors were encountered: