Skip to content

Commit 794767e

Browse files
committed
Upgrade Babel + React + React Native Web
1 parent f818986 commit 794767e

File tree

6 files changed

+7129
-3467
lines changed

6 files changed

+7129
-3467
lines changed

docs/.storybook/babel.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['module:metro-react-native-babel-preset'],
5+
plugins: ['react-native-web']
6+
};
7+
};

docs/.storybook/webpack.config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ const webpack = require('webpack');
44
module.exports = (storybookBaseConfig, configType) => {
55
const DEV = configType === 'DEVELOPMENT';
66

7+
const libDirectory = path.resolve(__dirname, '../../');
8+
79
storybookBaseConfig.module.rules.push({
810
test: /\.js$/,
9-
exclude: /node_modules/,
11+
include: [
12+
path.resolve(libDirectory, 'src'),
13+
],
1014
use: {
1115
loader: 'babel-loader',
12-
options: { cacheDirectory: true }
16+
options: {
17+
cacheDirectory: true,
18+
presets: ['module:metro-react-native-babel-preset'],
19+
plugins: ['react-native-web'],
20+
}
1321
}
1422
});
1523

@@ -20,8 +28,10 @@ module.exports = (storybookBaseConfig, configType) => {
2028
})
2129
);
2230

31+
storybookBaseConfig.resolve.extensions = ['.web.js', '.js', '.json', '.web.jsx', '.jsx'];
32+
2333
storybookBaseConfig.resolve.alias = {
24-
'react-native': 'react-native-web',
34+
'react-native$': 'react-native-web',
2535
'lottie-react-native': path.join(__dirname, '../../src/')
2636
};
2737

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"release": "yarn build && git checkout gh-pages && rm -rf ../storybook && mv dist ../storybook && git add -A && git commit -m \"Storybook deploy\" && git push origin gh-pages && git checkout -"
66
},
77
"dependencies": {
8-
"@storybook/addon-options": "^3.2.10",
9-
"@storybook/react": "^3.1.9"
8+
"@storybook/addon-options": "^4.1.11",
9+
"@storybook/react": "^4.1.11"
1010
}
1111
}

0 commit comments

Comments
 (0)