-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmetro.config.js
More file actions
26 lines (21 loc) · 797 Bytes
/
metro.config.js
File metadata and controls
26 lines (21 loc) · 797 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
26
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');
const config = getDefaultConfig(__dirname);
// 只為 Web 平台添加 react-native-maps 和 react-native-pager-view 的 mock
config.resolver.resolveRequest = (context, moduleName, platform) => {
if (platform === 'web' && moduleName === 'react-native-maps') {
return {
filePath: path.resolve(__dirname, 'react-native-maps-mock.js'),
type: 'sourceFile',
};
}
if (platform === 'web' && moduleName === 'react-native-pager-view') {
return {
filePath: path.resolve(__dirname, 'react-native-pager-view-mock.js'),
type: 'sourceFile',
};
}
// 使用預設解析器
return context.resolveRequest(context, moduleName, platform);
};
module.exports = config;