diff --git a/config-overrides.js b/config-overrides.js new file mode 100644 index 0000000..92a1086 --- /dev/null +++ b/config-overrides.js @@ -0,0 +1,25 @@ +const { + addWebpackAlias, + babelInclude, + fixBabelImports, + override +} = require("customize-cra"); + +const path = require("path"); + +module.exports = override( + fixBabelImports("module-resolver", { + alias: { + "^react-native$": "react-native-web" + } + }), + addWebpackAlias({ + "react-native": "react-native-web", + "react-native-svg": "svgs" // not necessary unless you wanted to do this + }), + babelInclude([ + path.resolve("src"), // make sure you link your own source + // any react-native modules you need babel to compile i.e + // path.resolve("node_modules/react-native-vector-icons") + ]) +); diff --git a/package.json b/package.json index 2593e63..8f8a043 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "start": "react-native start", "ios": "react-native run-ios", "android": "react-native run-android", - "web": "react-scripts start", - "build": "react-scripts build", + "web": "react-app-rewired start", + "build": "react-app-rewired build", "debug": "open 'rndebugger://set-debugger-loc?host=localhost&port=8081'", "lint": "eslint 'src/**/*.[jt]s?(x)' && tsc", "test": "jest -u --forceExit --coverage --verbose --detectOpenHandles", @@ -30,11 +30,14 @@ "@types/react-test-renderer": "16.9.0", "@typescript-eslint/parser": "^2.0.0", "babel-jest": "24.9.0", + "babel-plugin-import": "^1.12.2", + "customize-cra": "^0.8.0", "eslint": "6.2.1", "eslint-config-prettier": "^6.1.0", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-react-hooks": "^2.0.1", "metro-react-native-babel-preset": "0.56.0", + "react-app-rewired": "^2.1.5", "react-test-renderer": "16.9.0", "typescript": "3.5.3" }, diff --git a/yarn.lock b/yarn.lock index 34d585c..a6c106e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2149,6 +2149,14 @@ babel-plugin-dynamic-import-node@2.3.0, babel-plugin-dynamic-import-node@^2.3.0: dependencies: object.assign "^4.1.0" +babel-plugin-import@^1.12.2: + version "1.12.2" + resolved "https://registry.yarnpkg.com/babel-plugin-import/-/babel-plugin-import-1.12.2.tgz#bb8e11dabae68fbff4484c8e2bc2db1e086286a8" + integrity sha512-Vz9s+I6vAnsY8sYczU/cdtkKAHSorapa/2St6K+OzowplKizpWxul4HLi3kj1eRmHMFjhbROSMGXP+mFna2nUw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/runtime" "^7.0.0" + babel-plugin-istanbul@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" @@ -3435,6 +3443,13 @@ csstype@^2.2.0: resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.6.tgz#c34f8226a94bbb10c32cc0d714afdf942291fc41" integrity sha512-RpFbQGUE74iyPgvr46U9t1xoQBM8T4BL8SxrN66Le2xYAPSaDJJKeztV3awugusb3g3G9iL8StmkBBXhcbbXhg== +customize-cra@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/customize-cra/-/customize-cra-0.8.0.tgz#011e65fde9e443733668551740b76e3eefe95822" + integrity sha512-fIiuM4sJfDmTc+0ctNV0BCnSTsfq76bpAOHvUCrCzWaG1dHpHw2Yfec+liH4EdicG5TuwhYLFt2yY2ocJ8HoxA== + dependencies: + lodash.flow "^3.5.0" + cyclist@~0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" @@ -6752,6 +6767,11 @@ lodash._reinterpolate@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= +lodash.flow@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/lodash.flow/-/lodash.flow-3.5.0.tgz#87bf40292b8cf83e4e8ce1a3ae4209e20071675a" + integrity sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o= + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -9248,6 +9268,13 @@ react-app-polyfill@^1.0.2: regenerator-runtime "0.13.3" whatwg-fetch "3.0.0" +react-app-rewired@^2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.5.tgz#592ec2eae5c3c5cd96c80930b5dc3f6c34da1dc6" + integrity sha512-Gr8KfCeL9/PTQs8Vvxc7v8wQ9vCFMnYPhcAkrMlzkLiMFXS+BgSwm11MoERjZm7dpA2WjTi+Pvbu/w7rujAV+A== + dependencies: + semver "^5.6.0" + react-deep-force-update@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.1.2.tgz#3d2ae45c2c9040cbb1772be52f8ea1ade6ca2ee1"