Skip to content

Commit 298fd70

Browse files
authored
docs: update expo metro.config.js (storybookjs#441)
1 parent 3879460 commit 298fd70

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

MANUAL_SETUP.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,26 @@ export default StorybookUIRoot;
9292

9393
Update your metro config to include sbmodern in the resolverMainFields.
9494

95-
On expo you might need create the metro.config.js file.
95+
**Expo**
96+
97+
First create metro config file if you don't have it yet.
98+
```sh
99+
npx expo customize metro.config.js
100+
```
101+
102+
Then add sbmodern to the start of the `resolver.resolverMainFields` list.
103+
104+
```js
105+
const { getDefaultConfig } = require('expo/metro-config');
106+
107+
const defaultConfig = getDefaultConfig(__dirname);
108+
109+
defaultConfig.resolver.resolverMainFields.unshift('sbmodern');
110+
111+
module.exports = defaultConfig;
112+
```
113+
114+
**React native**
96115

97116
```js
98117
module.exports = {

MIGRATION.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,27 @@ export const parameters = {
100100

101101
We use the sbmodern resolver field in order to resolve the modern version of storybook packages. Doing this removes the polyfills that ship in commonjs modules and fixes multiple long standing issues such as the promises never resolving bug and more (caused by corejs promises polyfill).
102102

103+
**Expo**
104+
105+
First create metro config file if you don't have it yet.
106+
```sh
107+
npx expo customize metro.config.js
108+
```
109+
110+
Then add sbmodern to the start of the `resolver.resolverMainFields` list.
111+
112+
```js
113+
const { getDefaultConfig } = require('expo/metro-config');
114+
115+
const defaultConfig = getDefaultConfig(__dirname);
116+
117+
defaultConfig.resolver.resolverMainFields.unshift('sbmodern');
118+
119+
module.exports = defaultConfig;
120+
```
121+
122+
**React native**
123+
103124
```js
104125
module.exports = {
105126
/* existing config */

0 commit comments

Comments
 (0)