-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deep merge module resolve options (#7470)
- Loading branch information
Showing
13 changed files
with
92 additions
and
30 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
7 changes: 7 additions & 0 deletions
7
packages/rspack-test-tools/tests/configCases/module/merge-resolve/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 @@ | ||
import { lib } from "lib"; | ||
import * as reexports from "./reexports"; | ||
|
||
it("should use correct resolve options", () => { | ||
expect(lib).toBe("lib"); | ||
expect(reexports.lib).toBe("lib2"); | ||
}) |
7 changes: 7 additions & 0 deletions
7
packages/rspack-test-tools/tests/configCases/module/merge-resolve/modules/lib/package.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,7 @@ | ||
{ | ||
"name": "lib", | ||
"exports": { | ||
"server": "./right.js", | ||
"default": "./wrong.js" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/configCases/module/merge-resolve/modules/lib/right.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 lib = "lib" |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/configCases/module/merge-resolve/modules/lib/wrong.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 @@ | ||
throw new Error("wrong conditionNames") |
7 changes: 7 additions & 0 deletions
7
packages/rspack-test-tools/tests/configCases/module/merge-resolve/modules/lib2/package.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,7 @@ | ||
{ | ||
"name": "server-lib", | ||
"exports": { | ||
"server": "./right.js", | ||
"default": "./wrong.js" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/configCases/module/merge-resolve/modules/lib2/right.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 lib = "lib2" |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/configCases/module/merge-resolve/modules/lib2/wrong.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 @@ | ||
throw new Error("wrong conditionNames") |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/configCases/module/merge-resolve/reexports.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 "server-lib"; |
24 changes: 24 additions & 0 deletions
24
packages/rspack-test-tools/tests/configCases/module/merge-resolve/rspack.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,24 @@ | ||
/** @type {import("@rspack/core").Configuration} */ | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js/, | ||
resolve: { | ||
conditionNames: ["server"], | ||
} | ||
}, | ||
{ | ||
test: /reexports\.js/, | ||
resolve: { | ||
alias: { | ||
"server-lib": "lib2", | ||
} | ||
} | ||
}, | ||
] | ||
}, | ||
resolve: { | ||
modules: ["modules"] | ||
} | ||
}; |
c0ea8ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open
c0ea8ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open