Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unable to resolve "immer" from .... #1065

Closed
1 of 3 tasks
jeyjeycodes opened this issue Aug 14, 2023 · 5 comments
Closed
1 of 3 tasks

Unable to resolve "immer" from .... #1065

jeyjeycodes opened this issue Aug 14, 2023 · 5 comments

Comments

@jeyjeycodes
Copy link

jeyjeycodes commented Aug 14, 2023

🐛 Bug Report

I am building an Mobile App using React Native, Expo 49 (Hermes engine I believe).

I had installed the latest version of immer which is (10.0.2) My IDE is picking it up and I am able to use it perfectly fine. HOWEVER, when I try run it locally, I get this error:
Screenshot 2023-08-14 at 15 22 10

So I then downgraded slowly and eventually when I hit version 9.0.21 it worked perfectly and was able to locally build and run the project smoothly :).

Also I am using yarn but I doubt that is the problem.

Link to repro

My packages:

{
	"name": "supabasetutorial",
	"version": "1.0.0",
	"main": "expo-router/entry",
	"scripts": {
		"start": "expo start --clear",
		"android": "expo start --android",
		"ios": "expo start --ios",
		"dev:client": "expo start --dev-client",
		"web": "expo start --web",
		"typecheck": "tsc --noEmit",
		"lint": "eslint '*/**/*.{js,ts,tsx}' --fix"
	},
	"dependencies": {
		"@expo/vector-icons": "^13.0.0",
		"@gorhom/bottom-sheet": "^4",
		"@gorhom/portal": "^1.0.14",
		"@hookform/resolvers": "^3.1.1",
		"@react-native-async-storage/async-storage": "1.18.2",
		"@react-native-community/datetimepicker": "7.2.0",
		"@react-navigation/material-top-tabs": "^6.6.3",
		"@react-navigation/native": "^6.1.7",
		"@supabase/supabase-js": "^2.2.0",
		"@tanstack/query-async-storage-persister": "^4.32.6",
		"@tanstack/react-query": "^4.29.19",
		"@tanstack/react-query-persist-client": "^4.32.6",
		"axios": "^1.4.0",
		"base64-arraybuffer": "^1.0.2",
		"dayjs": "^1.11.9",
		"expo": "^49.0.0",
		"expo-clipboard": "~4.3.1",
		"expo-constants": "~14.4.2",
		"expo-crypto": "~12.4.1",
		"expo-device": "~5.4.0",
		"expo-image-picker": "~14.3.2",
		"expo-linking": "~5.0.2",
		"expo-notifications": "~0.20.1",
		"expo-router": "2.0.0",
		"expo-secure-store": "~12.3.1",
		"expo-splash-screen": "~0.20.5",
		"expo-status-bar": "~1.6.0",
		"immer": "9.0.21",
		"react": "18.2.0",
		"react-dom": "18.2.0",
		"react-hook-form": "^7.45.0",
		"react-native": "0.72.3",
		"react-native-currency-input": "^1.1.0",
		"react-native-dotenv": "^3.4.9",
		"react-native-dropdown-picker": "^5.4.6",
		"react-native-gesture-handler": "~2.12.0",
		"react-native-google-places-autocomplete": "^2.5.1",
		"react-native-keyboard-aware-scroll-view": "^0.9.5",
		"react-native-maps": "1.7.1",
		"react-native-pager-view": "6.2.0",
		"react-native-paper": "^5.9.1",
		"react-native-reanimated": "~3.3.0",
		"react-native-safe-area-context": "4.6.3",
		"react-native-screens": "~3.22.0",
		"react-native-svg": "13.9.0",
		"react-native-tab-view": "^3.5.2",
		"react-native-url-polyfill": "^1.3.0",
		"react-native-web": "~0.19.6",
		"yup": "^1.2.0",
		"zustand": "^4.3.9"
	},
	"devDependencies": {
		"@babel/core": "^7.20.0",
		"@types/react": "^18.2.20",
		"@typescript-eslint/eslint-plugin": "^5.61.0",
		"@typescript-eslint/parser": "^5.61.0",
		"eslint": "^8.44.0",
		"eslint-config-universe": "^11.3.0",
		"eslint-plugin-prettier": "^5.0.0",
		"eslint-plugin-unused-imports": "^3.0.0",
		"prettier": "^3.0.0",
		"typescript": "^5.1.3"
	},
	"eslintConfig": {
		"extends": "universe"
	},
	"private": true
}

same for version 10.0.2

To Reproduce

Load any mobile app using expo 49:
Here is a repo I used and it was the same issue on there aswell:
https://github.com/aaronksaunders/expo-router-supabase-tanstack/tree/main.

yarn add immer

yarn ios (you may need xcode and an IOS emulator and probably expo cli)

Environment

We only accept bug reports against the latest Immer version.

  • Immer version:
  • I filed this report against the latest version of Immer
  • Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)
@markerikson
Copy link
Contributor

Dupe of #1058, but yeah, concerning that this seems to be popping up.

@GustavoBonfimS
Copy link

GustavoBonfimS commented Aug 28, 2023

I fix this downgrading Immer to 9.0.21

yarn add immer@9.0.21

@truongtv22
Copy link

Add extension .mjs to resolver.sourceExts array

const { getDefaultConfig } = require('expo/metro-config');

const config = getDefaultConfig(__dirname);

config.resolver.sourceExts.push('mjs');

module.exports = config;

https://docs.expo.dev/guides/customizing-metro/

@luccasr73
Copy link

@truongtv22 thank u so much! solved my problem

@mweststrate
Copy link
Collaborator

I think immer@10.0.3-beta solves it for everyone. Would someone mind verifying? Then I'll cut an official release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants