@react-native/metro-config 0.72.6 → 0.72.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +16 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* @noformat
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
/*:: import type {
|
|
11
|
+
/*:: import type {ConfigT} from 'metro-config'; */
|
|
12
12
|
|
|
13
|
-
const {mergeConfig} = require('metro-config');
|
|
13
|
+
const {getDefaultConfig: getBaseConfig, mergeConfig} = require('metro-config');
|
|
14
14
|
|
|
15
15
|
const INTERNAL_CALLSITES_REGEX = new RegExp(
|
|
16
16
|
[
|
|
@@ -38,14 +38,18 @@ const INTERNAL_CALLSITES_REGEX = new RegExp(
|
|
|
38
38
|
|
|
39
39
|
function getDefaultConfig(
|
|
40
40
|
projectRoot /*: string */
|
|
41
|
-
) /*:
|
|
42
|
-
|
|
41
|
+
) /*: ConfigT */ {
|
|
42
|
+
const config = {
|
|
43
43
|
resolver: {
|
|
44
44
|
resolverMainFields: ['react-native', 'browser', 'main'],
|
|
45
45
|
platforms: ['android', 'ios'],
|
|
46
46
|
unstable_conditionNames: ['require', 'import', 'react-native'],
|
|
47
47
|
},
|
|
48
48
|
serializer: {
|
|
49
|
+
// Note: This option is overridden in cli-plugin-metro (getOverrideConfig)
|
|
50
|
+
getModulesRunBeforeMainModule: () => [
|
|
51
|
+
require.resolve('react-native/Libraries/Core/InitializeCore'),
|
|
52
|
+
],
|
|
49
53
|
getPolyfills: () => require('@react-native/js-polyfills')(),
|
|
50
54
|
},
|
|
51
55
|
server: {
|
|
@@ -77,6 +81,14 @@ function getDefaultConfig(
|
|
|
77
81
|
},
|
|
78
82
|
watchFolders: [],
|
|
79
83
|
};
|
|
84
|
+
|
|
85
|
+
// Set global hook so that the CLI can detect when this config has been loaded
|
|
86
|
+
global.__REACT_NATIVE_METRO_CONFIG_LOADED = true;
|
|
87
|
+
|
|
88
|
+
return mergeConfig(
|
|
89
|
+
getBaseConfig.getDefaultValues(projectRoot),
|
|
90
|
+
config,
|
|
91
|
+
);
|
|
80
92
|
}
|
|
81
93
|
|
|
82
94
|
module.exports = {getDefaultConfig, mergeConfig};
|