2021-04-08 11:37:35 -06:00
|
|
|
/**
|
|
|
|
* Metro configuration for React Native
|
|
|
|
* https://github.com/facebook/react-native
|
|
|
|
*
|
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const blacklist = require('metro-config/src/defaults/blacklist');
|
|
|
|
|
|
|
|
const rnPath = fs.realpathSync(
|
|
|
|
path.resolve(require.resolve('react-native/package.json'), '..'),
|
|
|
|
);
|
|
|
|
const rnwPath = fs.realpathSync(
|
|
|
|
path.resolve(require.resolve('react-native-windows/package.json'), '..'),
|
|
|
|
);
|
|
|
|
|
2019-09-16 11:32:01 -06:00
|
|
|
module.exports = {
|
2021-04-08 11:37:35 -06:00
|
|
|
resolver: {
|
|
|
|
extraNodeModules: {
|
|
|
|
// Redirect react-native to react-native-windows
|
|
|
|
'react-native': rnwPath,
|
|
|
|
'react-native-windows': rnwPath,
|
|
|
|
},
|
|
|
|
// Include the macos platform in addition to the defaults because the fork includes macos, but doesn't declare it
|
|
|
|
platforms: ['ios', 'android', 'windesktop', 'windows', 'web', 'macos'],
|
|
|
|
// Since there are multiple copies of react-native, we need to ensure that metro only sees one of them
|
|
|
|
// This should go in RN 0.61 when haste is removed
|
|
|
|
blacklistRE: blacklist([
|
|
|
|
new RegExp(
|
|
|
|
`${(path.resolve(rnPath) + path.sep).replace(/[/\\]/g, '/')}.*`,
|
|
|
|
),
|
|
|
|
|
|
|
|
// This stops "react-native run-windows" from causing the metro server to crash if its already running
|
|
|
|
new RegExp(
|
|
|
|
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
|
|
|
|
),
|
|
|
|
// Prevent recursive node_modules from local react-native-video
|
|
|
|
new RegExp(
|
|
|
|
`${path.resolve(__dirname, 'node_modules/react-native-video/node_modules').replace(/[/\\]/g, '/')}.*`,
|
|
|
|
),
|
|
|
|
// Prevent recursive examples from local react-native-video
|
|
|
|
new RegExp(
|
|
|
|
`${path.resolve(__dirname, 'node_modules/react-native-video/examples').replace(/[/\\]/g, '/')}.*`,
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
},
|
2019-09-16 11:32:01 -06:00
|
|
|
transformer: {
|
|
|
|
getTransformOptions: async () => ({
|
|
|
|
transform: {
|
|
|
|
experimentalImportSupport: false,
|
|
|
|
inlineRequires: false,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
2021-04-08 11:37:35 -06:00
|
|
|
};
|