| 
									
										
										
										
											2023-09-26 11:39:17 +02:00
										 |  |  | const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config') | 
					
						
							|  |  |  | const path = require('path') | 
					
						
							|  |  |  | const escape = require('escape-string-regexp') | 
					
						
							|  |  |  | const exclusionList = require('metro-config/src/defaults/exclusionList') | 
					
						
							|  |  |  | const pak = require('../package.json') | 
					
						
							| 
									
										
										
										
											2021-02-19 16:07:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-26 11:39:17 +02:00
										 |  |  | const root = path.resolve(__dirname, '..') | 
					
						
							|  |  |  | const modules = Object.keys({ ...pak.peerDependencies }) | 
					
						
							| 
									
										
										
										
											2021-02-19 16:07:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 12:50:14 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Metro configuration | 
					
						
							|  |  |  |  * https://facebook.github.io/metro/docs/configuration
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @type {import('metro-config').MetroConfig} | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | const config = { | 
					
						
							| 
									
										
										
										
											2021-02-19 16:07:53 +01:00
										 |  |  |   watchFolders: [root], | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // We need to make sure that only one version is loaded for peerDependencies
 | 
					
						
							| 
									
										
										
										
											2023-07-03 12:40:07 +02:00
										 |  |  |   // So we block them at the root, and alias them to the versions in example's node_modules
 | 
					
						
							| 
									
										
										
										
											2021-02-19 16:07:53 +01:00
										 |  |  |   resolver: { | 
					
						
							| 
									
										
										
										
											2023-07-03 12:40:07 +02:00
										 |  |  |     blacklistRE: exclusionList( | 
					
						
							|  |  |  |       modules.map( | 
					
						
							|  |  |  |         (m) => | 
					
						
							|  |  |  |           new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) | 
					
						
							|  |  |  |       ) | 
					
						
							|  |  |  |     ), | 
					
						
							| 
									
										
										
										
											2021-02-19 16:07:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     extraNodeModules: modules.reduce((acc, name) => { | 
					
						
							| 
									
										
										
										
											2023-09-26 11:39:17 +02:00
										 |  |  |       acc[name] = path.join(__dirname, 'node_modules', name) | 
					
						
							|  |  |  |       return acc | 
					
						
							| 
									
										
										
										
											2021-02-19 16:07:53 +01:00
										 |  |  |     }, {}), | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   transformer: { | 
					
						
							|  |  |  |     getTransformOptions: async () => ({ | 
					
						
							|  |  |  |       transform: { | 
					
						
							| 
									
										
										
										
											2023-07-03 12:40:07 +02:00
										 |  |  |         experimentalImportSupport: false, | 
					
						
							| 
									
										
										
										
											2021-02-19 16:07:53 +01:00
										 |  |  |         inlineRequires: true, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-09-26 11:39:17 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-08-21 12:50:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-26 11:39:17 +02:00
										 |  |  | module.exports = mergeConfig(getDefaultConfig(__dirname), config) |