drizzle-kit generate throws SyntaxError: Cannot use import statement outside a module

I have been using drizzle alongside React Native, and everything worked great. Unexpectedly drizzle-kit generate stopped working - I built my app and after that it started throwing... It throws with the following error:
Z:\Projects\React Native Test\project_1\node_modules\react-native\index.js:15
import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1153:20)
at Module._compile (node:internal/modules/cjs/loader:1205:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at newLoader (Z:\Projects\React Native Test\project_1\node_modules\drizzle-kit\bin.cjs:15044:13)
at Object.newLoader (Z:\Projects\React Native Test\project_1\node_modules\drizzle-kit\bin.cjs:15044:13)
at extensions..js (Z:\Projects\React Native Test\project_1\node_modules\drizzle-kit\bin.cjs:17572:28)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
Z:\Projects\React Native Test\project_1\node_modules\react-native\index.js:15
import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1153:20)
at Module._compile (node:internal/modules/cjs/loader:1205:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at newLoader (Z:\Projects\React Native Test\project_1\node_modules\drizzle-kit\bin.cjs:15044:13)
at Object.newLoader (Z:\Projects\React Native Test\project_1\node_modules\drizzle-kit\bin.cjs:15044:13)
at extensions..js (Z:\Projects\React Native Test\project_1\node_modules\drizzle-kit\bin.cjs:17572:28)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
I tried deleting node_modules/, .expo/ package-lock and restarting everything, checked if all versions were up to date... with no luck.... I can't figure out why it would throw an error for code, from another library, where it does not even get called... Before I start my project from scratch again, anyone had an issue similar to this? 😅
1 Reply
Angelelz
Angelelz•5w ago
To the best of my knowledge, drizzle-kit is bundled as commonjs So if you're calling anything in yout drizzle config that doesn't use commonjs, it might be the cause of your issue I might be wrong though
Want results from more Discord servers?
Add your server