Skip to content

Commit ff4d9e1

Browse files
committed
fix(example-app): 🐛 fix metro config which caused web build fail
1 parent 5fcfe0d commit ff4d9e1

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

example/metro.config.js

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,38 @@ const path = require("path");
22
const exclusionList = require("metro-config/src/defaults/exclusionList");
33
const escape = require("escape-string-regexp");
44
const pak = require("../package.json");
5-
const { getDefaultConfig } = require("@expo/metro-config");
65

76
const root = path.resolve(__dirname, "..");
87

98
const modules = Object.keys({
109
...pak.peerDependencies,
1110
});
1211

13-
module.exports = (async () => {
14-
const config = await getDefaultConfig(__dirname);
15-
const { transformer, resolver } = config;
12+
module.exports = {
13+
projectRoot: __dirname,
14+
watchFolders: [root],
1615

17-
(config.projectRoot = __dirname),
18-
(config.watchFolders = [root]),
19-
// We need to make sure that only one version is loaded for peerDependencies
20-
// So we blacklist them at the root, and alias them to the versions in example's node_modules
21-
(config.resolver = {
22-
...resolver,
23-
blacklistRE: exclusionList(
24-
modules.map(
25-
m =>
26-
new RegExp(`^${escape(path.join(root, "node_modules", m))}\\/.*$`),
27-
),
16+
// We need to make sure that only one version is loaded for peerDependencies
17+
// So we blacklist them at the root, and alias them to the versions in example's node_modules
18+
resolver: {
19+
blacklistRE: exclusionList(
20+
modules.map(
21+
m => new RegExp(`^${escape(path.join(root, "node_modules", m))}\\/.*$`),
2822
),
23+
),
2924

30-
extraNodeModules: modules.reduce((acc, name) => {
31-
acc[name] = path.join(__dirname, "node_modules", name);
32-
return acc;
33-
}, {}),
25+
extraNodeModules: modules.reduce((acc, name) => {
26+
acc[name] = path.join(__dirname, "node_modules", name);
27+
return acc;
28+
}, {}),
29+
},
30+
31+
transformer: {
32+
getTransformOptions: async () => ({
33+
transform: {
34+
experimentalImportSupport: false,
35+
inlineRequires: true,
36+
},
3437
}),
35-
(config.transformer = {
36-
...transformer,
37-
getTransformOptions: async () => ({
38-
transform: {
39-
experimentalImportSupport: false,
40-
inlineRequires: true,
41-
},
42-
}),
43-
});
44-
return config;
45-
})();
38+
},
39+
};

0 commit comments

Comments
 (0)