Skip to content

Commit

Permalink
react -> react-native: support npm run web-clean on Windows and avo…
Browse files Browse the repository at this point in the history
…id error `node_modules\sane\src\node_watcher.js:291:16`
  • Loading branch information
flyskywhy committed Dec 20, 2022
1 parent 9fea458 commit e037acd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* @format
*/
const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
transformer: {
Expand All @@ -17,5 +18,16 @@ module.exports = {
resolver: {
assetExts: ['dds', 'txt', 'jpg', 'png'],
sourceExts: ['js', 'json', 'ts', 'tsx', 'jsx'],
blacklistRE: blacklist([
// to avoid error below when `npm run web-clean` besides `npm run rn` on Windows
//events.js:174
// throw er; // Unhandled 'error' event
// ^
// Error: EPERM: operation not permitted, lstat 'D:\proj\GCanvasRNExamples\node_modules\.cache\default-development'
// Emitted 'error' event at:
// at NodeWatcher.<anonymous> (D:\proj\GCanvasRNExamples\node_modules\sane\src\node_watcher.js:291:16)
// at FSReqWrap.oncomplete (fs.js:153:21)
/node_modules\/\.cache/,
]),
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bundle-android": "cross-env ./android/gradlew bundleRelease --offline -x lint -x lintVitalRelease -p ./android/",
"ios": "node node_modules/react-native/local-cli/cli.js run-ios",
"web": "cross-env PLATFORM_OS=web DISABLE_ESLINT_PLUGIN=true react-app-rewired start",
"web-clean": "rimraf node_modules/.cache/default-development",
"web-fresh": "rm -fr node_modules/.cache/*; cross-env PLATFORM_OS=web DISABLE_ESLINT_PLUGIN=true react-app-rewired start",
"build-web": "cross-env PLATFORM_OS=web DISABLE_ESLINT_PLUGIN=true react-app-rewired build",
"start": "react-scripts start",
Expand Down

0 comments on commit e037acd

Please sign in to comment.