Skip to content
This repository was archived by the owner on Jun 16, 2023. It is now read-only.

Commit 4522841

Browse files
committed
fix(android): fix bug Duplicate module rn
fixing bug Duplicate module react-native when running the mlkit and basic examples 1) adding metro.config.js to examples/basic and examples/mlkit 2) adding new RegExp in blacklist to ignore the advanced/node_modules/react-native/.* files
1 parent ea0e9e6 commit 4522841

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

examples/basic/metro.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* This file overrides metro config so
3+
*/
4+
'use strict';
5+
6+
const path = require('path');
7+
const blacklist = require('metro-config/src/defaults/blacklist');
8+
9+
const reactNativeCameraRoot = path.resolve(__dirname, '..', '..');
10+
11+
module.exports = {
12+
transformer: {
13+
getTransformOptions: async () => ({
14+
transform: {
15+
experimentalImportSupport: false,
16+
inlineRequires: false,
17+
},
18+
}),
19+
},
20+
watchFolders: [path.resolve(__dirname, 'node_modules'), reactNativeCameraRoot],
21+
resolver: {
22+
blacklistRE: blacklist([
23+
new RegExp(`${reactNativeCameraRoot}/examples/mlkit/.*`),
24+
new RegExp(`${reactNativeCameraRoot}/node_modules/react-native/.*`),
25+
new RegExp(
26+
`${reactNativeCameraRoot}/examples/advanced/advanced/node_modules/react-native/.*`,
27+
),
28+
]),
29+
},
30+
};

examples/mlkit/metro.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* This file overrides metro config so
3+
*/
4+
'use strict';
5+
6+
const path = require('path');
7+
const blacklist = require('metro-config/src/defaults/blacklist');
8+
9+
const reactNativeCameraRoot = path.resolve(__dirname, '..', '..');
10+
11+
module.exports = {
12+
transformer: {
13+
getTransformOptions: async () => ({
14+
transform: {
15+
experimentalImportSupport: false,
16+
inlineRequires: false,
17+
},
18+
}),
19+
},
20+
watchFolders: [path.resolve(__dirname, 'node_modules'), reactNativeCameraRoot],
21+
resolver: {
22+
blacklistRE: blacklist([
23+
new RegExp(`${reactNativeCameraRoot}/examples/basic/.*`),
24+
new RegExp(`${reactNativeCameraRoot}/node_modules/react-native/.*`),
25+
new RegExp(
26+
`${reactNativeCameraRoot}/examples/advanced/advanced/node_modules/react-native/.*`,
27+
),
28+
]),
29+
},
30+
};

0 commit comments

Comments
 (0)