forked from webpack/webpack
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
test/cases/side-effects/dynamic-reexports/dedupe-target-static/a.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,3 @@ | ||
export * from "./module"; | ||
if (process.env.NODE_ENV !== "development") | ||
throw new Error("Should not be loaded"); |
1 change: 1 addition & 0 deletions
1
test/cases/side-effects/dynamic-reexports/dedupe-target-static/b.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 @@ | ||
export * from "./module"; |
2 changes: 2 additions & 0 deletions
2
test/cases/side-effects/dynamic-reexports/dedupe-target-static/index.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,2 @@ | ||
export * from "./a"; | ||
export * from "./b"; |
1 change: 1 addition & 0 deletions
1
test/cases/side-effects/dynamic-reexports/dedupe-target-static/module.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 @@ | ||
export const value = 42; |
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 "./empty"; | ||
if (process.env.NODE_ENV !== "development") | ||
throw new Error("Should not be loaded"); |
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 * from "./empty"; |
Empty file.
2 changes: 2 additions & 0 deletions
2
test/cases/side-effects/dynamic-reexports/dedupe-target/index.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,2 @@ | ||
export * from "./a"; | ||
export * from "./b"; |
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 default 42; |
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 @@ | ||
module.exports = 42; |
Empty file.
7 changes: 7 additions & 0 deletions
7
test/cases/side-effects/dynamic-reexports/default-export/index.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,7 @@ | ||
export { default as a } from "./a"; | ||
export { default as b } from "./b"; | ||
export { default as empty } from "./empty"; | ||
export { default as json } from "./json"; | ||
|
||
if (process.env.NODE_ENV !== "development") | ||
throw new Error("Should not be loaded"); |
1 change: 1 addition & 0 deletions
1
test/cases/side-effects/dynamic-reexports/default-export/json.json
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 @@ | ||
42 |
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,23 @@ | ||
import { value as valueStatic } from "./dedupe-target-static"; | ||
import { value } from "./dedupe-target"; | ||
import * as DefaultExport from "./default-export"; | ||
|
||
it("should dedupe static reexport target", () => { | ||
expect(valueStatic).toBe(42); | ||
}); | ||
|
||
it("should dedupe dynamic reexport target", () => { | ||
expect(value).toBe(undefined); | ||
}); | ||
|
||
it("should optimize dynamic default reexport", () => { | ||
expect(DefaultExport.a).toBe(42); | ||
expect(DefaultExport.b).toBe(42); | ||
expect(DefaultExport.empty).toEqual({}); | ||
expect(DefaultExport.json).toBe(42); | ||
}); | ||
|
||
it("should handle default export when reexporting", () => { | ||
const module = Object(require("./reexports-excludes-default")); | ||
expect(module.test).toBe(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 @@ | ||
{ | ||
"sideEffects": false | ||
} |
Empty file.
1 change: 1 addition & 0 deletions
1
test/cases/side-effects/dynamic-reexports/reexports-excludes-default/index.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 @@ | ||
export * from "./module"; |
2 changes: 2 additions & 0 deletions
2
test/cases/side-effects/dynamic-reexports/reexports-excludes-default/module.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,2 @@ | ||
export * from "./empty"; | ||
export const test = 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 const value = 42; | ||
export const unused = __webpack_exports_info__.value.used; | ||
export const unprovided = __webpack_exports_info__.other.provideInfo; |