66 */
77const fs = require ( "fs" ) ;
88const path = require ( "path" ) ;
9- const blacklist = require ( "metro-config/src/defaults/blacklist" ) ;
9+
10+ const exclusionList = ( ( ) => {
11+ try {
12+ return require ( "metro-config/src/defaults/exclusionList" ) ;
13+ } catch ( _ ) {
14+ // `blacklist` was renamed to `exclusionList` in 0.60
15+ return require ( "metro-config/src/defaults/blacklist" ) ;
16+ }
17+ } ) ( ) ;
1018
1119const rnPath = fs . realpathSync (
1220 path . resolve ( require . resolve ( "react-native/package.json" ) )
@@ -15,31 +23,30 @@ const rnwPath = fs.realpathSync(
1523 path . resolve ( require . resolve ( "react-native-windows/package.json" ) )
1624) ;
1725
26+ const blockList = exclusionList ( [
27+ // Since there are multiple copies of react-native, we need to ensure that
28+ // Metro only sees one of them. This should go when haste-map is removed.
29+ new RegExp ( `${ ( path . resolve ( rnPath ) + path . sep ) . replace ( / [ / \\ ] / g, "/" ) } .*` ) ,
30+
31+ // This stops "react-native run-windows" from causing the metro server to
32+ // crash if its already running
33+ new RegExp ( `${ path . resolve ( __dirname , "windows" ) . replace ( / [ / \\ ] / g, "/" ) } .*` ) ,
34+
35+ // Workaround for `EBUSY: resource busy or locked, open
36+ // '~\msbuild.ProjectImports.zip'` when building with `yarn windows --release`
37+ / .* \. P r o j e c t I m p o r t s \. z i p / ,
38+ ] ) ;
39+
1840module . exports = {
1941 resolver : {
2042 extraNodeModules : {
2143 // Redirect react-native to react-native-windows
2244 "react-native" : rnwPath ,
2345 "react-native-windows" : rnwPath ,
2446 } ,
25- // Include the macos platform in addition to the defaults because the fork includes macos, but doesn't declare it
26- platforms : [ "ios" , "android" , "windesktop" , "windows" , "web" , "macos" ] ,
27- // Since there are multiple copies of react-native, we need to ensure that metro only sees one of them
28- // This should go in RN 0.61 when haste is removed
29- blacklistRE : blacklist ( [
30- new RegExp (
31- `${ ( path . resolve ( rnPath ) + path . sep ) . replace ( / [ / \\ ] / g, "/" ) } .*`
32- ) ,
33-
34- // This stops "react-native run-windows" from causing the metro server to crash if its already running
35- new RegExp (
36- `${ path . resolve ( __dirname , "windows" ) . replace ( / [ / \\ ] / g, "/" ) } .*`
37- ) ,
38-
39- // Workaround for `EBUSY: resource busy or locked, open '~\msbuild.ProjectImports.zip'`
40- // when building with `yarn windows --release`
41- / .* \. P r o j e c t I m p o r t s \. z i p / ,
42- ] ) ,
47+ platforms : [ "windesktop" , "windows" ] ,
48+ blacklistRE : blockList ,
49+ blockList,
4350 } ,
4451 transformer : {
4552 getTransformOptions : async ( ) => ( {
0 commit comments