pubnub / javascript

PubNub JavaScript SDK docs https://www.pubnub.com/docs/sdks/javascript
Other
553 stars 401 forks source link

SDK package too large for Lambda, contains frontend frameworks #383

Open tmcpartlin opened 5 months ago

tmcpartlin commented 5 months ago

Since the SDK includes React and React Native this SDK is very large.

The dependency on react-native-url-polyfill seems to be causing all the other dependencies. After removing this package, the SDK is much smaller.

Suggestion: have an optional package that can be just for the NodeJS server side that does not include these frontend frameworks and dependencies.

andrewpuch commented 4 months ago

I'm running into the same issue.

yo1dog commented 1 month ago

The problem is the react-native-url-polyfill which in turn includes the entire react-native library.

├─┬ pubnub@8.2.8
│ ├─┬ react-native-url-polyfill@2.0.0
│ │ ├── react-native@0.75.4

Upgrading to v8 adds 464 NPM packages, several of which are deprecated. It is quite ridiculous to pollute projects to such an extreme extent. I can't upgrade to v8 until this is fixed because it makes the project too large...

yo1dog commented 1 month ago

Here is my workaround. Prevent react-native-url-polyfill from being included (and thus react-native) by adding an NPM override to package.json:

  "overrides": {
    "pubnub": {
      "react-native-url-polyfill": "npm:pubnub@*"
    }
  }

I use pubnub@* because it is a package I know is already installed and thus will not add to the dependency tree, but you can specify any package.