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

Commit

Permalink
fix(android): fix bug Duplicate module rn
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fabOnReact committed Mar 10, 2020
1 parent ea0e9e6 commit 4522841
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/basic/metro.config.js
Original file line number Diff line number Diff line change
@@ -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/.*`,
),
]),
},
};
30 changes: 30 additions & 0 deletions examples/mlkit/metro.config.js
Original file line number Diff line number Diff line change
@@ -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/.*`,
),
]),
},
};

0 comments on commit 4522841

Please sign in to comment.