Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix module resolution

ammarahm-ed2b94212552d2
diff --git a/apps/mobile/native/metro.config.js b/apps/mobile/native/metro.config.js
index a2adab622..e20944548 100644
--- a/apps/mobile/native/metro.config.js
+++ b/apps/mobile/native/metro.config.js
@@ -23,7 +23,17 @@ module.exports = {
"react": path.join(__dirname, "../node_modules/react"),
"react-dom": path.join(__dirname, "../node_modules/react-dom"),
"@notesnook": path.join(__dirname, "../../../packages"),
- "@notifee/react-native": path.join(__dirname, "../node_modules/@ammarahmed/notifee-react-native")
+ "@notifee/react-native": path.join(__dirname, "../node_modules/@ammarahmed/notifee-react-native"),
+ },
+ resolveRequest: (context, moduleName, platform) => {
+ if (moduleName ==='react') {
+ // Resolve react package from mobile app's node_modules folder always.
+ return {
+ filePath: path.resolve(path.join(__dirname, '../node_modules', "react","index.js")),
+ type: 'sourceFile',
+ };
+ }
+ return context.resolveRequest(context, moduleName, platform);
}
},
transformer: {
diff --git a/packages/common/package-lock.json b/packages/common/package-lock.json
index 3203af506..601381be0 100644
--- a/packages/common/package-lock.json
+++ b/packages/common/package-lock.json
@@ -8,10 +8,12 @@
"name": "@notesnook/common",
"version": "1.0.0",
"license": "GPL-3.0-or-later",
+ "dependencies": {
+ "timeago.js": "4.0.2"
+ },
"devDependencies": {
"@types/react": "17.0.2",
"react": "17.0.2",
- "timeago.js": "4.0.2",
"typescript": "^4.8.2"
},
"peerDependencies": {
@@ -84,8 +86,7 @@
"node_modules/timeago.js": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/timeago.js/-/timeago.js-4.0.2.tgz",
- "integrity": "sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w==",
- "dev": true
+ "integrity": "sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w=="
},
"node_modules/typescript": {
"version": "4.9.5",
@@ -158,8 +159,7 @@
"timeago.js": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/timeago.js/-/timeago.js-4.0.2.tgz",
- "integrity": "sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w==",
- "dev": true
+ "integrity": "sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w=="
},
"typescript": {
"version": "4.9.5",