-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prioritize static reexport over runtime reexport for target determina…
…tion this allows to optimize cases where empty modules are reexported e. g. caused by typescript type-only exports
- Loading branch information
Showing
13 changed files
with
140 additions
and
35 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const a = "a"; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const b = "b"; |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { a, b } from "./module"; | ||
import * as empty from "./empty"; | ||
|
||
it("should skip over module", () => { | ||
empty.a = "not a"; | ||
empty.b = "not b"; | ||
expect(a).toBe("a"); | ||
expect(b).toBe("b"); | ||
expect(__STATS__.children.length).toBe(2); | ||
for (const stats of __STATS__.children) { | ||
const module = stats.modules.find(m => m.name.endsWith("module.js")); | ||
expect(module).toHaveProperty("orphan", true); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./a"; | ||
export * from "./empty"; | ||
export * from "./b"; |
22 changes: 22 additions & 0 deletions
22
test/configCases/side-effects/type-reexports/webpack.config.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = [ | ||
{ | ||
output: { | ||
pathinfo: "verbose" | ||
}, | ||
optimization: { | ||
concatenateModules: true, | ||
sideEffects: true, | ||
usedExports: true | ||
} | ||
}, | ||
{ | ||
output: { | ||
pathinfo: "verbose" | ||
}, | ||
optimization: { | ||
concatenateModules: false, | ||
sideEffects: true, | ||
usedExports: true | ||
} | ||
} | ||
]; |
Oops, something went wrong.