Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: set ws as optional dependency #448

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

filipecabaco
Copy link
Member

What kind of change does this PR introduce?

set ws as optional dependency so users can exclude them when using react native with npm install --omit=optional

@aldebout
Copy link

I tried a pnpm override with this branch but I get Error: Cannot find module '/.../node_modules/@supabase/realtime-js/scripts/remove-ws-if-expo.js'.

Maybe you need to add scripts to the file list in package.json?

@filipecabaco
Copy link
Member Author

yes 👍 just got the same error on a test repo 🤦

@filipecabaco
Copy link
Member Author

made the change will test on project

@filipecabaco filipecabaco force-pushed the fix/selective-import-of-ws branch from 0387cca to caab152 Compare December 19, 2024 17:44
@filipecabaco
Copy link
Member Author

having postinstall for now it was a bad move, first getting smaller change to use npm omit optional

@filipecabaco
Copy link
Member Author

I'm doing the following:
In https://github.com/haeniya/supabase-realtime-repro.git

  1. Set package.json to git://github.com/supabase/supabase-js.git#fix/realtime-optional-ws
{
  "name": "supabase-realtime-repro",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^2.1.0",
    "@supabase/supabase-js": "git://github.com/supabase/supabase-js.git#fix/realtime-optional-ws",
    "aes-js": "^3.1.2",
    "expo": "~52.0.11",
    "expo-secure-store": "~14.0.0",
    "expo-status-bar": "~2.0.0",
    "react": "18.3.1",
    "react-native": "0.76.3",
    "react-native-get-random-values": "^1.11.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.3.12",
    "typescript": "^5.3.3"
  },
  "private": true
}
  1. Run npm i --omit=optional to not install ws as it will be a optional dependency

  2. npm start and use iOS

unfortunately got the following error

Screenshot 2024-12-19 at 18 27 40

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

Successfully merging this pull request may close these issues.

2 participants