ably / ably-chat-js

Ably Chat SDK for JavaScript to build chat experiences at scale
https://ably-livestream-chat-demo.vercel.app/
Apache License 2.0
8 stars 0 forks source link

Unable to resolve "@ably/chat/react" #366

Open ahilles107 opened 2 weeks ago

ahilles107 commented 2 weeks ago

hey folks! I'm trying to update js client from 0.1.0 to 0.2.1 in my react native (expo) app and I get this error:

Unable to resolve "@ably/chat/react" from "src/screens/ChatRoomScreen.tsx" somehow expo does not see the new entry point.

AndyTWF commented 2 weeks ago

Hey @ahilles107 !

This may because of how Expo/Metro resolves modules. There's a specific setting that has to be enabled in metro.config.js to allow it to properly resolve the React package:

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

const defaultConfig = getDefaultConfig(__dirname);

module.exports = {
  ...defaultConfig,
  resolver: {
    ...defaultConfig.resolver,
    unstable_enablePackageExports: true, // Enable 'exports' field in package.json,
  },
};

I also set "moduleResolution": "Bundler" in ts.config.json so that my VSCode could handle the exports.

Does this resolve the issue for you? If it does I'll add it to the README :)