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
This commit is contained in:
fabriziobertoglio1987 2020-03-10 10:12:11 +01:00
parent ea0e9e68e7
commit 4522841f8a
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,30 @@
/**
* This file overrides metro config so
*/
'use strict';
const path = require('path');
const blacklist = require('metro-config/src/defaults/blacklist');
const reactNativeCameraRoot = path.resolve(__dirname, '..', '..');
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
watchFolders: [path.resolve(__dirname, 'node_modules'), reactNativeCameraRoot],
resolver: {
blacklistRE: blacklist([
new RegExp(`${reactNativeCameraRoot}/examples/mlkit/.*`),
new RegExp(`${reactNativeCameraRoot}/node_modules/react-native/.*`),
new RegExp(
`${reactNativeCameraRoot}/examples/advanced/advanced/node_modules/react-native/.*`,
),
]),
},
};

View File

@ -0,0 +1,30 @@
/**
* This file overrides metro config so
*/
'use strict';
const path = require('path');
const blacklist = require('metro-config/src/defaults/blacklist');
const reactNativeCameraRoot = path.resolve(__dirname, '..', '..');
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
watchFolders: [path.resolve(__dirname, 'node_modules'), reactNativeCameraRoot],
resolver: {
blacklistRE: blacklist([
new RegExp(`${reactNativeCameraRoot}/examples/basic/.*`),
new RegExp(`${reactNativeCameraRoot}/node_modules/react-native/.*`),
new RegExp(
`${reactNativeCameraRoot}/examples/advanced/advanced/node_modules/react-native/.*`,
),
]),
},
};