forked from expo/expo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetro.config.js
More file actions
25 lines (20 loc) · 809 Bytes
/
Copy pathmetro.config.js
File metadata and controls
25 lines (20 loc) · 809 Bytes
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
const { createMetroConfiguration } = require('expo-yarn-workspaces');
const baseConfig = createMetroConfiguration(__dirname);
module.exports = {
...baseConfig,
// NOTE(brentvatne): This can be removed when
// https://github.com/facebook/metro/issues/290 is fixed.
server: {
enhanceMiddleware: middleware => {
return (req, res, next) => {
// When an asset is imported outside the project root, it has wrong path on Android
// This happens for the back button in stack, so we fix the path to correct one
const assets = '/node_modules/@react-navigation/stack/src/views/assets';
if (req.url.startsWith(assets)) {
req.url = req.url.replace(assets, `/assets/..${assets}`);
}
return middleware(req, res, next);
};
},
},
};