This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
forked from staltz/manyverse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metro.config.js
63 lines (58 loc) · 1.81 KB
/
metro.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// SPDX-FileCopyrightText: 2021 The Manyverse Authors
//
// SPDX-License-Identifier: CC0-1.0
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const path = require('path');
const OriginalResolver = require('metro-resolver');
const blocklist = require('metro-config/src/defaults/exclusionList');
const IGNORE_ON_MOBILE = ['fs', 'nuka-carousel'];
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
resolver: {
platforms: ['android', 'ios', 'web'],
blacklistRE: blocklist([
/\/android\/.*/,
/\/desktop\/.*/,
/\/benchmark\/.*/,
/\/e2e\/.*/,
/\/ios\/.*/,
/\/lib\/backend\/.*/,
/\/nodejs-assets\/.*/,
/\/patches\/.*/,
/\/src\/backend\/.*/,
/\/tools\/.*/,
// Not used in runtime (is either dev dependency or surely not used)
/\/node_modules\/appium\/.*/,
// Handled by Webpack (for Desktop), so Metro (for Mobile) can ignore:
/\/node_modules\/@cycle\/react-dom\/.*/,
/\/node_modules\/electron\/.*/,
/\/node_modules\/electron\.*\/.*/,
/\/node_modules\/react-dom\/.*/,
/\/node_modules\/webpack\/.*/,
/\/node_modules\/webpack-cli\/.*/,
]),
resolveRequest: (context, realModuleName, platform, moduleName) => {
const platformIsMobile = platform !== 'web';
if (platformIsMobile && IGNORE_ON_MOBILE.includes(moduleName)) {
return {
filePath: path.resolve(__dirname + '/noop.js'),
type: 'sourceFile',
};
} else {
return OriginalResolver.resolve(
{...context, resolveRequest: undefined},
moduleName,
platform,
);
}
},
},
};