forked from software-mansion/react-native-gesture-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (43 loc) · 1.33 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
const {
conditionMatchesFile,
getRules,
} = require('@expo/webpack-config/utils');
const { resolve } = require('path');
module.exports = async function(env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
// Get all rules
const rules = getRules(config);
// Get all JS rules
const jsLoaders = rules.filter(
({ rule }) =>
rule.test && conditionMatchesFile(rule, resolve(__dirname, 'foo.js'))
);
for (const loader of jsLoaders) {
// Use custom web babel.config.js
loader.rule.use.options = {
...loader.rule.use.options,
babelrc: false,
configFile: false,
presets: [require.resolve('babel-preset-expo')],
plugins: [
[
require.resolve('babel-plugin-module-resolver'),
{
alias: {
'react-native-gesture-handler': './',
react: './node_modules/react',
'@egjs/hammerjs': './node_modules/@egjs/hammerjs',
fbjs: './node_modules/fbjs',
'hoist-non-react-statics':
'./node_modules/hoist-non-react-statics',
invariant: './node_modules/invariant',
'prop-types': './node_modules/prop-types',
},
},
],
],
};
}
return config;
};