Skip to content

Commit 2479da9

Browse files
committed
chore: tweak metro config
1 parent 5197ee2 commit 2479da9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

example/metro.config.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const escape = require('escape-string-regexp');
66
const blacklist = require('metro-config/src/defaults/blacklist');
77

88
const root = path.resolve(__dirname, '..');
9-
const packages = path.resolve(__dirname, '..', 'packages');
9+
const packages = path.resolve(root, 'packages');
1010

1111
// Get the list of dependencies for all packages in the monorepo
1212
const modules = ['@expo/vector-icons']
@@ -22,7 +22,7 @@ const modules = ['@expo/vector-icons']
2222
);
2323

2424
// We need to collect list of deps that this package imports
25-
// Collecting both dependencies are peerDependencies sould do it
25+
// Collecting both dependencies are peerDependencies should do it
2626
return Object.keys({
2727
...pak.dependencies,
2828
...pak.peerDependencies,
@@ -59,19 +59,19 @@ module.exports = {
5959
// When we import a package from the monorepo, metro won't be able to find their deps
6060
// We need to specify them in `extraNodeModules` to tell metro where to find them
6161
extraNodeModules: modules.reduce((acc, name) => {
62-
acc[name] = path.join(__dirname, '..', 'node_modules', name);
62+
acc[name] = path.join(root, 'node_modules', name);
6363
return acc;
6464
}, {}),
6565
},
6666

6767
server: {
6868
enhanceMiddleware: middleware => {
6969
return (req, res, next) => {
70+
// When an asset is imported outside the project root, it has wrong path on Android
71+
// This happens for the back button in stack, so we fix the path to correct one
7072
const assets = '/packages/stack/src/views/assets';
7173

7274
if (req.url.startsWith(assets)) {
73-
// When an asset is imported outside the project root, it has wrong path on Android
74-
// This happens for the back button in stack, so we fix the path to correct one
7575
req.url = req.url.replace(
7676
assets,
7777
'/assets/../packages/stack/src/views/assets'

0 commit comments

Comments
 (0)