Skip to content

Commit f2002f7

Browse files
metro setup to v0.78
1 parent b9bb337 commit f2002f7

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

fabric-example/metro.config.js

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,40 @@
1-
/**
2-
* Metro configuration for React Native
3-
* https://github.com/facebook/react-native
4-
*
5-
* @format
6-
*/
7-
1+
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
82
const path = require('path');
9-
const exclusionList = (() => {
10-
try {
11-
return require('metro-config/src/defaults/exclusionList');
12-
} catch (_) {
13-
// `blacklist` was renamed to `exclusionList` in 0.60
14-
return require('metro-config/src/defaults/blacklist');
15-
}
16-
})();
3+
const exclusionList = require('metro-config/src/defaults/exclusionList');
174
const escape = require('escape-string-regexp');
185
const pack = require('../package.json');
196

207
const root = path.resolve(__dirname, '..');
21-
228
const modules = [...Object.keys(pack.peerDependencies)];
239

2410
const blockList = exclusionList([
2511
/node_modules\/.*\/node_modules\/react-native\/.*/,
26-
2712
// This stops "react-native run-windows" from causing the metro server to
2813
// crash if its already running
2914
new RegExp(`${path.join(__dirname, 'windows').replace(/[/\\]+/g, '/')}.*`),
30-
3115
// Workaround for `EPERM: operation not permitted, lstat '~\midl-MIDLRT-cl.read.1.tlog'`
3216
/.*\.tlog/,
33-
3417
// Prevent Metro from watching temporary files generated by Visual Studio
3518
// otherwise it may crash when they are removed when closing a project.
3619
/.*\/.vs\/.*/,
37-
3820
// Workaround for `EBUSY: resource busy or locked, open '~\msbuild.ProjectImports.zip'`
3921
/.*\.ProjectImports\.zip/,
40-
4122
...modules.map(
4223
(m) => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
4324
),
4425
]);
4526

46-
module.exports = {
27+
const config = {
4728
projectRoot: __dirname,
4829
watchFolders: [root],
4930
resolver: {
50-
blacklistRE: blockList,
5131
blockList,
32+
blacklistRE: blockList,
5233
extraNodeModules: modules.reduce((acc, name) => {
5334
acc[name] = path.join(__dirname, 'node_modules', name);
5435
return acc;
5536
}, {}),
37+
assetExts: [...getDefaultConfig(__dirname).resolver.assetExts, 'png'],
5638
},
5739
transformer: {
5840
getTransformOptions: async () => ({
@@ -63,3 +45,5 @@ module.exports = {
6345
}),
6446
},
6547
};
48+
49+
module.exports = mergeConfig(getDefaultConfig(__dirname), config);

0 commit comments

Comments
 (0)