diff --git a/scripts/patch-react-devtools.sh b/scripts/patch-react-devtools.sh new file mode 100755 index 00000000..2b3b8edd --- /dev/null +++ b/scripts/patch-react-devtools.sh @@ -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 diff --git a/scripts/prepackage.sh b/scripts/prepackage.sh index 71d39ab6..fa942d6f 100755 --- a/scripts/prepackage.sh +++ b/scripts/prepackage.sh @@ -1,4 +1,6 @@ #!/bin/bash npm run build -cd dist && npm i +cd dist && npm i && cd - + +./scripts/patch-react-devtools.sh