Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15282 from webpack/feature/__webpack_module__
add __webpack_module__ and __webpack_module_id__ to the api
- Loading branch information
Showing
6 changed files
with
54 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default __webpack_module_id__; |
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,18 @@ | ||
import id from "./id"; | ||
import mod from "./module"; | ||
import modType from "./typeof-module"; | ||
|
||
it("should support __webpack_module_id__", () => { | ||
expect(typeof id).toMatch(/^(string|number)$/); | ||
expect(id).not.toBe(__webpack_module_id__); | ||
}); | ||
|
||
it("should support __webpack_module__", () => { | ||
expect(mod.exports).toBeTypeOf("object"); | ||
expect(typeof mod.id).toMatch(/^(string|number)$/); | ||
expect(mod).not.toBe(__webpack_module__); | ||
}); | ||
|
||
it("should support typeof __webpack_module__", () => { | ||
expect(modType).toBe("object"); | ||
}); |
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 __webpack_module__; |
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 typeof __webpack_module__; |