Skip to content

Commit 38e613a

Browse files
committed
Fix web support
1 parent 6cd38eb commit 38e613a

File tree

5 files changed

+5529
-120
lines changed

5 files changed

+5529
-120
lines changed

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"devDependencies": {
2020
"@babel/core": "~7.9.0",
21+
"@expo/webpack-config": "^0.12.68",
2122
"@types/react": "~16.9.35",
2223
"@types/react-dom": "~16.9.8",
2324
"@types/react-native": "~0.63.2",

example/webpack.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const path = require('path')
2+
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
3+
const { resolver } = require('./metro.config')
4+
5+
const root = path.resolve(__dirname, '..')
6+
const node_modules = path.join(__dirname, 'node_modules')
7+
8+
module.exports = async function (env, argv) {
9+
const config = await createExpoWebpackConfigAsync(env, argv)
10+
11+
config.module.rules.push({
12+
test: /\.(js|ts|tsx)$/,
13+
include: path.resolve(root, 'src'),
14+
use: 'babel-loader',
15+
})
16+
17+
Object.assign(config.resolve.alias, {
18+
...resolver.extraNodeModules,
19+
'react-native-web': path.join(node_modules, 'react-native-web'),
20+
})
21+
22+
return config
23+
}

0 commit comments

Comments
 (0)