I'm submitting a bug report
Webpack version:
2.1.0-beta.20
Current behavior:
Tree shaking works with re-exports like "export { something } from 'module'" but doesn't work with "export * from 'module'".
Expected/desired behavior:
Tree shaking works with any kind of re-export.
app/
my-feature/
func12.js
func34.js
index.js
main.js
func12.js
export function func1() { console.log("func1") }
export function func2() { console.log("func2") }
func34.js
export function func3() { console.log("func3") }
export function func4() { console.log("func4") }
index.js
export * from "./func12"
export * from "./func34"
main.js
import { func1, func3 } from "./my-feature"
func1();
func3();
Also, changing index.js like this
export { func1, func2 } from "./func12"
export { func3, func4 } from "./func34"
solves the problem, but I can't change all the third party modules to follow that rule.
Same bug unfortunately, tree shaking is not working with export * from
.
We'll fix it..
Most helpful comment
Also, changing index.js like this
solves the problem, but I can't change all the third party modules to follow that rule.