Created
January 26, 2017 14:19
-
-
Save simlrh/9b17aa98f4a9f0a44208ac40d10ea5c1 to your computer and use it in GitHub Desktop.
Tree shaking example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { d, e, f } from "./def.js"; | |
// a is used | |
export const a = d + " is part of a"; | |
// b is unused | |
export const b = e + " is part of b"; | |
// c is unused | |
export const c = f + " is part of c"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const d = "d"; | |
export const e = "e"; | |
export const f = "f"; | |
/* | |
* d, e and f will all be marked as "used" because they are imported into abc.js | |
* but e and f will never be used because the variables that rely on them are unused. | |
* Assuming I am able to detect this situation (it's a specific kind of module), | |
* is it possible to tell webpack that these exports are actually unused? | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { a } from "./abc.js"; | |
document.write(a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment