ndeed, none of these files exist: * /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs(.native|.android.ts|.native.ts|
tiavina-mika opened this issue · comments
my environment:
OS: macOS 10.15.0
Computer model: Mac Mini 2012
React Native: 0.64.3
Expo: 44.0.0
Node: v14.18.2
when i run "yarn android" on macOS I got this error:
Android Bundling failed 99474ms
While trying to resolve module idb-keyval
from file /Users/mini12/Documents/Projects/yourz-mobile/node_modules/parse/lib/react-native/IndexedDBStorageController.js
, the package /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/package.json
was successfully found. However, this package itself specifies a main
module field that could not be resolved (/Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs
. Indeed, none of these files exist:
- /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
- /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
I am having the exactly same problem!!! :(
It looks like the issue is with React Native. There's a suggested workaround here, but I haven't tested facebook/metro#535 (comment)
Let me know if that works.
It looks like the issue is with React Native. There's a suggested workaround here, but I haven't tested facebook/metro#535 (comment)
Let me know if that works.
Hi! This code solved for me... phew!!!
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const defaultSourceExts =
require('metro-config/src/defaults/defaults').sourceExts;
module.exports = {
transformer: {
getTransformOptions: () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
sourceExts: process.env.RN_SRC_EXT
? [...process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts), 'cjs', 'jsx']
: [...defaultSourceExts, 'cjs', 'jsx'],
},
};
Look I had to add jsx too... Do not ask me why... :(
@jakearchibald , @carlnx thanks, it's worked
Well... now another issue that I did not understand :(
When I use parse (see code), it happens the error:
[Unhandled promise rejection: ReferenceError: Can't find variable: indexedDB]
at node_modules/idb-keyval/dist/compat.cjs:34:12 in createStore
The code that calls this error:
import AsyncStorage from '@react-native-async-storage/async-storage';
const bdParse = () => {
const Parse = require('parse/react-native.js');
Parse.setAsyncStorage(AsyncStorage);
//APP_ID
Parse.initialize('xxxxxxxxxx');
Parse.masterKey = 'xxxxxxxxx';
Parse.serverURL = 'https://xxxx.xzxxx.xxx.xx.xx/parse';
return Parse;
}
Any ideas? :(
You must be using abc.js instead of abc.jsx
use import React from "react"; in the .js file and issue would be solved..!!!