-
-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fallback to next main field when resolve failed (#7670)
- Loading branch information
1 parent
997fc80
commit af0cb1c
Showing
7 changed files
with
35 additions
and
141 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
packages/rspack-test-tools/tests/configCases/resolve/main-field-fallback/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,5 @@ | ||
import { foo } from 'invalid-pkg' | ||
|
||
it("should fallback from module to main when resolve failed", () => { | ||
expect(foo).toBe(42); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...est-tools/tests/configCases/resolve/main-field-fallback/node_modules/invalid-pkg/exist.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...tools/tests/configCases/resolve/main-field-fallback/node_modules/invalid-pkg/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
packages/rspack-test-tools/tests/configCases/resolve/main-field-fallback/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,19 @@ | ||
const path = require("path"); | ||
|
||
/** | ||
* @type {import('webpack').Configuration | import('@rspack/cli').Configuration} | ||
*/ | ||
module.exports = { | ||
devtool: false, | ||
entry: { | ||
main: { | ||
import: "./index.js", | ||
}, | ||
}, | ||
resolve: { | ||
mainFields: ['module', 'main'], | ||
extensionAlias: { | ||
'.js': ['.ts', '.js'] | ||
} | ||
}, | ||
}; |
af0cb1c
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
af0cb1c
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