This commit is contained in:
Tobias Koppers 2016-09-09 14:20:29 +02:00
parent ac340bce1d
commit c08d1b4f89
11 changed files with 67 additions and 10 deletions

View File

@ -59,6 +59,7 @@ FlagDependencyExportsPlugin.prototype.apply = function(compiler) {
});
}
var changed = false;
if(module.providedExports !== true) {
if(exports === true) {
module.providedExports = true;
changed = true;
@ -70,6 +71,7 @@ FlagDependencyExportsPlugin.prototype.apply = function(compiler) {
changed = true;
}
};
}
if(changed) {
var deps = dependencies["$" + module.identifier()];
if(deps) {

View File

@ -0,0 +1 @@
export var a;

View File

@ -0,0 +1 @@
export var b;

View File

@ -0,0 +1,25 @@
Hash: 11b123cb23c353a91fe4
Time: Xms
Asset Size Chunks Chunk Names
bundle.js 6.46 kB 0 [emitted] main
chunk {0} bundle.js (main) 512 bytes [entry] [rendered]
[0] (webpack)/test/statsCases/tree-shaking/a.js 13 bytes {0} [built]
[exports: a]
[only some exports used: a]
[1] (webpack)/test/statsCases/tree-shaking/b.js 13 bytes {0} [built]
[exports: b]
[only some exports used: ]
[2] (webpack)/test/statsCases/tree-shaking/unknown.js 0 bytes {0} [built]
[only some exports used: a, c]
[3] (webpack)/test/statsCases/tree-shaking/reexport-known.js 49 bytes {0} [built]
[exports: a, b]
[only some exports used: a]
[4] (webpack)/test/statsCases/tree-shaking/reexport-star-known.js 41 bytes {0} [built]
[exports: a, b]
[only some exports used: a]
[5] (webpack)/test/statsCases/tree-shaking/reexport-star-unknown.js 68 bytes {0} [built]
[only some exports used: a, c]
[6] (webpack)/test/statsCases/tree-shaking/reexport-unknown.js 83 bytes {0} [built]
[exports: a, b, c, d]
[only some exports used: a, c]
[7] (webpack)/test/statsCases/tree-shaking/index.js 245 bytes {0} [built]

View File

@ -0,0 +1,6 @@
import { a as a1 } from "./reexport-known";
import { a as a2, c as c2 } from "./reexport-unknown";
import { a as a3} from "./reexport-star-known";
import { a as a4, c as c4 } from "./reexport-star-unknown";
console.log(a1, a2, a3, a4, c2, c4);

View File

@ -0,0 +1,2 @@
export { a } from "./a";
export { b } from "./b";

View File

@ -0,0 +1,2 @@
export * from "./a";
export * from "./b";

View File

@ -0,0 +1,3 @@
export * from "./a";
export * from "./b";
export * from "./unknown";

View File

@ -0,0 +1,3 @@
export { a } from "./a";
export { b } from "./b";
export { c, d } from "./unknown";

View File

View File

@ -0,0 +1,12 @@
module.exports = {
entry: "./index",
output: {
filename: "bundle.js"
},
stats: {
chunkModules: false,
modules: true,
providedExports: true,
usedExports: true
}
};