Skip to content

Commit

Permalink
Fix react-devtools not auto detect system theme
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jul 23, 2023
1 parent 8cc850b commit 98ed518
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/patch-modules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const shell = require('shelljs');
const path = require('path');

console.log('Patch react-devtools-core');

const rdStandalone = path.join(
__dirname,
'../dist/node_modules/react-devtools-core/dist/standalone.js'
);

// Make react-devtools-core to auto detect theme
// We still use this patch because patch-package to patch js bundle is not very ideal
shell.sed(
'-i',
// eslint-disable-next-line
/bridge:e,browserTheme:t="light"/,
'bridge:e,browserTheme:t="auto"',
rdStandalone
);
2 changes: 2 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ async function run() {
'-rf',
'node_modules/apollo-client-devtools/{assets,build,development,shells/dev,src}'
);
// eslint-disable-next-line
require('./patch-modules');
}

run();

0 comments on commit 98ed518

Please sign in to comment.