Closed iamhaaamed closed 2 months ago
DId you find a solution ?
DId you find a solution ?
No, not yet
@iamhaaamed - what does your babel config look like?
@iamhaaamed - what does your babel config look like?
This is my babel.config file:
module.exports = function (api) {
api.cache(true);
return {
presets: [
['babel-preset-expo', { jsxImportSource: 'nativewind' }],
'nativewind/babel',
],
plugins: [
[
'module-resolver',
{
root: ['./'],
alias: {
'@': './src',
'@env': './src/core/env.js',
},
extensions: [
'.ios.ts',
'.android.ts',
'.ts',
'.ios.tsx',
'.android.tsx',
'.tsx',
'.jsx',
'.js',
'.json',
],
},
],
'react-native-reanimated/plugin',
],
};
};
I had this exact issue, so I am trying to remember which thing was incorrect...
Do you by chance have your package.json
configured to be a module
?
I had this exact issue, so I am trying to remember which thing was incorrect...
Do you by chance have your
package.json
configured to be amodule
?
No, my package.json is not configured to be a module.
This is my package.json file:
{
"name": "mypartslocator",
"version": "0.0.1",
"private": true,
"main": "expo-router/entry",
"scripts": {
"start": "cross-env EXPO_NO_DOTENV=1 expo start",
"prebuild": "cross-env EXPO_NO_DOTENV=1 pnpm expo prebuild",
"android": "cross-env EXPO_NO_DOTENV=1 expo run:android",
"ios": "cross-env EXPO_NO_DOTENV=1 expo run:ios",
"doctor": "npx expo-doctor@latest",
"preinstall": "npx only-allow pnpm",
"start:staging": "cross-env APP_ENV=staging pnpm run start",
"prebuild:staging": "cross-env APP_ENV=staging pnpm run prebuild",
"android:staging": "cross-env APP_ENV=staging pnpm run android",
"ios:staging": "cross-env APP_ENV=staging pnpm run ios",
"start:production": "cross-env APP_ENV=production pnpm run start",
"prebuild:production": "cross-env APP_ENV=production pnpm run prebuild",
"android:production": "cross-env APP_ENV=production pnpm run android",
"ios:production": "cross-env APP_ENV=production pnpm run ios",
"build:development:ios": "cross-env APP_ENV=development EXPO_NO_DOTENV=1 eas build --profile development --platform ios",
"build:development:android": "cross-env APP_ENV=development EXPO_NO_DOTENV=1 eas build --profile development --platform android ",
"build:staging:ios": "cross-env APP_ENV=staging EXPO_NO_DOTENV=1 eas build --profile staging --platform ios",
"build:staging:android": "cross-env APP_ENV=staging EXPO_NO_DOTENV=1 eas build --profile staging --platform android ",
"build:production:ios": "cross-env APP_ENV=production EXPO_NO_DOTENV=1 eas build --profile production --platform ios",
"build:production:android": "cross-env APP_ENV=production EXPO_NO_DOTENV=1 eas build --profile production --platform android ",
"postinstall": "husky install",
"app-release": "cross-env SKIP_BRANCH_PROTECTION=true np --no-publish --no-cleanup --no-release-draft",
"version": "pnpm run prebuild && git add .",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"type-check": "tsc --noemit",
"lint:translations": "eslint ./src/translations/ --fix --ext .json ",
"test": "jest",
"test:ci": "pnpm run test --coverage",
"test:watch": "pnpm run test --watch",
"install-maestro": "curl -Ls 'https://get.maestro.mobile.dev' | bash",
"e2e-test": "maestro test .maestro/ -e APP_ID=com.obytes.development"
},
"dependencies": {
"@expo/metro-runtime": "^3.1.3",
"@gorhom/bottom-sheet": "^4.6.0",
"@hookform/resolvers": "^2.9.11",
"@react-native-community/datetimepicker": "^7.7.0",
"@react-native-community/netinfo": "^11.3.1",
"@react-native-community/push-notification-ios": "^1.11.0",
"@react-native-firebase/analytics": "^19.2.2",
"@react-native-firebase/app": "^19.2.2",
"@react-native-firebase/crashlytics": "^19.2.2",
"@react-native-firebase/dynamic-links": "^19.2.2",
"@react-native-firebase/messaging": "^19.2.2",
"@react-navigation/bottom-tabs": "^6.5.11",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.17",
"@shopify/flash-list": "1.6.3",
"@tanstack/react-query": "^4.36.1",
"app-icon-badge": "^0.0.15",
"axios": "^1.6.5",
"dayjs": "^1.11.10",
"expo": "~50.0.17",
"expo-build-properties": "~0.11.1",
"expo-constants": "~15.4.6",
"expo-dev-client": "~3.3.11",
"expo-font": "~11.10.3",
"expo-image": "~1.10.6",
"expo-linking": "~6.2.2",
"expo-localization": "~14.8.4",
"expo-router": "~3.4.8",
"expo-splash-screen": "0.26.4",
"expo-status-bar": "~1.11.1",
"expo-system-ui": "~2.9.4",
"i18next": "^22.5.1",
"lodash.memoize": "^4.1.2",
"mime": "^4.0.1",
"moti": "^0.28.1",
"nativewind": "^4.0.36",
"navigation-utilities": "link:@/navigation/navigation-utilities",
"pusher-js": "8.4.0-rc2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-error-boundary": "^3.1.4",
"react-hook-form": "^7.49.3",
"react-i18next": "^12.3.1",
"react-icomoon": "^2.5.7",
"react-native": "0.73.6",
"react-native-audio-recorder-player": "^3.6.7",
"react-native-avoid-softinput": "^4.0.2",
"react-native-biometrics": "^3.0.1",
"react-native-curved-bottom-bar": "^3.2.7",
"react-native-device-info": "^10.13.2",
"react-native-flash-message": "^0.4.2",
"react-native-gesture-handler": "~2.14.1",
"react-native-image-crop-picker": "^0.40.3",
"react-native-mmkv": "2.6.3",
"react-native-modal-datetime-picker": "^17.1.0",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "~3.6.2",
"react-native-restart": "0.0.27",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-svg": "14.1.0",
"react-native-swiper": "^1.6.0",
"react-native-web": "~0.19.10",
"react-query-kit": "^3.2.0",
"tailwind-variants": "^0.1.20",
"zod": "^3.22.4",
"zustand": "^4.5.0"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@dev-plugins/react-navigation": "^0.0.5",
"@dev-plugins/react-query": "^0.0.5",
"@expo/config": "~8.5.4",
"@react-native-community/eslint-config": "^3.2.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react-native": "^12.4.3",
"@types/i18n-js": "^3.8.9",
"@types/jest": "^29.5.11",
"@types/lodash.memoize": "^4.1.9",
"@types/react": "~18.2.48",
"@types/react-native-push-notification": "^8.1.4",
"@types/react-test-renderer": "^18.0.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"babel-plugin-module-resolver": "^5.0.0",
"cross-env": "^7.0.3",
"dotenv": "^16.3.2",
"eslint": "^8.57.0",
"eslint-plugin-i18n-json": "^4.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-tailwindcss": "^3.10.1",
"eslint-plugin-testing-library": "^6.2.0",
"eslint-plugin-unicorn": "^46.0.1",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-expo": "~50.0.4",
"jest-junit": "^16.0.0",
"lint-staged": "^13.3.0",
"metro-babel-register": "^0.73.10",
"np": "^7.7.0",
"prettier": "^2.8.8",
"react-test-renderer": "^18.2.0",
"tailwindcss": "^3.3.2",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3"
},
"repository": {
"type": "git",
"url": "git+https://github.com/user/repo-name.git"
},
"packageManager": "pnpm@8.6.5",
"osMetadata": {
"initVersion": "5.3.0"
}
}
Mostly you are importing env.js file inside src folder. make sure you are importing env vars from '@env' and not directly from './env.js' file
Summary:
when trying to run the project i have this error:
this is my env.js file:
and this is my app.config.ts: