Skip to content

Commit

Permalink
Patch requestIdleCallback for react-devtools-core
Browse files Browse the repository at this point in the history
the `requestIdleCallback` have some problem on debug mode for Android, we can just let it use polyfill to avoid many issues until the problem is solved.
  • Loading branch information
jhen0409 committed Feb 24, 2017
1 parent 6f0f8a2 commit 3d3da36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions scripts/patch-react-devtools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

echo '\n\n## PATCH REACT DEVTOOLS\n'

FILE='./node_modules/react-devtools-core/build/backend.js'
SOURCE_MAP='./node_modules/react-devtools-core/build/backend.js.map'

TARGET='window.requestIdleCallback'
REPLACE='window.__REQUEST_IDLE_CALLBACK_REPLACED_BY_PATCH__'
sed -i '' s/$TARGET/$REPLACE/g $FILE
sed -i '' s/$TARGET/$REPLACE/g $SOURCE_MAP

TARGET='window.cancelIdleCallback'
REPLACE='window.__CANCEL_IDLE_CALLBACK_REPLACED_BY_PATCH__'
sed -i '' s/$TARGET/$REPLACE/g $FILE
sed -i '' s/$TARGET/$REPLACE/g $SOURCE_MAP
4 changes: 3 additions & 1 deletion scripts/prepackage.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

npm run build
cd dist && npm i
cd dist && npm i && cd -

./scripts/patch-react-devtools.sh

0 comments on commit 3d3da36

Please sign in to comment.