Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test case for resolve.fallback #12827

Merged
merged 1 commit into from Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions test/configCases/resolve/fallback/a/1.js
@@ -0,0 +1 @@
module.exports = 1;
1 change: 1 addition & 0 deletions test/configCases/resolve/fallback/a/2.js
@@ -0,0 +1 @@
module.exports = 'not 2';
1 change: 1 addition & 0 deletions test/configCases/resolve/fallback/b/2.js
@@ -0,0 +1 @@
module.exports = 2;
9 changes: 9 additions & 0 deletions test/configCases/resolve/fallback/index.js
@@ -0,0 +1,9 @@
it("ignores the fallback if an existing module is present", () => {
const two = require("./b/2");
expect(two).toBe(2);
});

it("can fallback if the module does not exist", () => {
const one = require("./b/1");
expect(one).toBe(1);
});
9 changes: 9 additions & 0 deletions test/configCases/resolve/fallback/webpack.config.js
@@ -0,0 +1,9 @@
const path = require("path");
/** @type {import("../../../../").Configuration} */
module.exports = {
resolve: {
fallback: {
"./b": path.resolve(__dirname, "a")
}
}
};