chore: fix webpack config for example

This commit is contained in:
Satyajit Sahoo
2020-01-04 01:48:34 +01:00
parent cbe240eae6
commit 543679f185

View File

@@ -4,6 +4,9 @@ const createExpoWebpackConfigAsync = require('@expo/webpack-config');
// eslint-disable-next-line import/no-extraneous-dependencies
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const node_modules = path.resolve(__dirname, 'node_modules');
const packages = path.resolve(__dirname, '..', 'packages');
module.exports = async function(env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
@@ -19,28 +22,15 @@ module.exports = async function(env, argv) {
);
Object.assign(config.resolve.alias, {
react: path.resolve(__dirname, 'node_modules', 'react'),
'react-native': path.resolve(__dirname, 'node_modules', 'react-native-web'),
'react-native-web': path.resolve(
__dirname,
'node_modules',
'react-native-web'
),
'react-native-reanimated': path.resolve(
__dirname,
'node_modules',
'react-native-reanimated-web'
),
'@expo/vector-icons/MaterialCommunityIcons': require.resolve(
'@expo/vector-icons/MaterialCommunityIcons'
),
react: path.resolve(node_modules, 'react'),
'react-native': path.resolve(node_modules, 'react-native-web'),
'react-native-web': path.resolve(node_modules, 'react-native-web'),
'@expo/vector-icons': path.resolve(node_modules, '@expo/vector-icons'),
});
fs.readdirSync(path.join(__dirname, '..')).forEach(name => {
fs.readdirSync(packages).forEach(name => {
config.resolve.alias[`@react-navigation/${name}`] = path.resolve(
__dirname,
'..',
'packages',
packages,
name,
'src'
);