Skip to content

Commit 98ed518

Browse files
committed
Fix react-devtools not auto detect system theme
1 parent 8cc850b commit 98ed518

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

scripts/patch-modules.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const shell = require('shelljs');
2+
const path = require('path');
3+
4+
console.log('Patch react-devtools-core');
5+
6+
const rdStandalone = path.join(
7+
__dirname,
8+
'../dist/node_modules/react-devtools-core/dist/standalone.js'
9+
);
10+
11+
// Make react-devtools-core to auto detect theme
12+
// We still use this patch because patch-package to patch js bundle is not very ideal
13+
shell.sed(
14+
'-i',
15+
// eslint-disable-next-line
16+
/bridge:e,browserTheme:t="light"/,
17+
'bridge:e,browserTheme:t="auto"',
18+
rdStandalone
19+
);

scripts/postinstall.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ async function run() {
1515
'-rf',
1616
'node_modules/apollo-client-devtools/{assets,build,development,shells/dev,src}'
1717
);
18+
// eslint-disable-next-line
19+
require('./patch-modules');
1820
}
1921

2022
run();

0 commit comments

Comments
 (0)