Skip to content

Commit a5f281a

Browse files
committed
chore: ✨ added script to supress require cycle warning
1 parent 1da5e47 commit a5f281a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"android": "expo start --android",
3838
"ios": "expo start --ios",
3939
"web": "expo start --web",
40-
"eject": "expo eject"
40+
"eject": "expo eject",
41+
"postinstall": "node ./scripts/supressWarning.js"
4142
},
4243
"keywords": [
4344
"react-native",

scripts/supressWarning.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const fs = require('fs');
2+
3+
const codeToObscure =
4+
/console.warn\([\s\S].*Require cycle:[\s\S].*\+[\s\S].*\+[\s\S].*"[\s\S].*/;
5+
const problemFilePath = './node_modules/metro-runtime/src/polyfills/require.js';
6+
const problemFileContent = fs.readFileSync(problemFilePath, 'utf8');
7+
fs.writeFileSync(
8+
problemFilePath,
9+
problemFileContent.replace(codeToObscure, 'const noConsoleWarn = ("");'),
10+
'utf8'
11+
);

0 commit comments

Comments
 (0)