forked from RocketChat/Rocket.Chat.ReactNative
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetro.config.js
More file actions
33 lines (28 loc) · 1.32 KB
/
metro.config.js
File metadata and controls
33 lines (28 loc) · 1.32 KB
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
const path = require('path');
const withStorybook = require('@storybook/react-native/metro/withStorybook');
const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts;
// eslint-disable-next-line import/no-unresolved
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const { wrapWithReanimatedMetroConfig } = require('react-native-reanimated/metro-config');
const sourceExts = [...defaultSourceExts, 'mjs'];
const config = {
transformer: {
unstable_allowRequireContext: true
},
resolver: {
// When running E2E tests, prioritize .mock.ts files for app code
// Note: react-native-mmkv's internal mock file is disabled via patch-package
sourceExts: process.env.RUNNING_E2E_TESTS === 'true' ? ['mock.ts', ...sourceExts] : sourceExts
}
};
const finalConfig = wrapWithReanimatedMetroConfig(mergeConfig(getDefaultConfig(__dirname), config));
const storybookOptions = {
// set to false to disable storybook specific settings
// you can use a env variable to toggle this
enabled: process.env.USE_STORYBOOK === 'true',
// path to your storybook config folder
configPath: path.resolve(__dirname, './.rnstorybook'),
// set this to true to remove storybook from the bundle when disabled
onDisabledRemoveStorybook: true
};
module.exports = withStorybook(finalConfig, storybookOptions);