Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb00bd3c

Browse files
vovkasmcpojer
andauthored
chore: add sample snippet to configure main fields for module resolution algorithm (#15687)
Co-authored-by: Christoph Nakazawa <xnakazawa@pm.me>
1 parent054fa33 commitb00bd3c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎website/versioned_docs/version-30.0/Configuration.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,19 @@ const config: Config = {
15291529
exportdefaultconfig;
15301530
```
15311531

1532+
Jest's`jest-resolve` relies on`unrs-resolver`. We can pass additional options, for example modifying`mainFields` for resolution. For example, for React Native projects, you might want to use this config:
1533+
1534+
```js
1535+
module.exports= (path,options)=> {
1536+
// Call the defaultResolver, so we leverage its cache, error handling, etc.
1537+
returnoptions.defaultResolver(path, {
1538+
...options,
1539+
// See this `unrs-resolver` option: from https://github.com/unrs/unrs-resolver?tab=readme-ov-file#main-field
1540+
mainFields: ['react-native','main'],
1541+
});
1542+
};
1543+
```
1544+
15321545
###`restoreMocks`\[boolean]
15331546

15341547
Default:`false`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp