Chat SDK v4 migration issues

Originally posted this under this topic. As we discover more issues, we decided open a separate topic.

We are experiencing a similar issue with sb.groupChannel, our workaround is to cast SendbirdChat.init() as SendbirdGroupChat

By the way, I got this warning while installing the package using yarn, not sure if it’s related

warn Package @sendbird/chat has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/<path-to-my-app>/node_modules/@sendbird/chat/package.json

Other than that, so far we realised that in v4 we can’t do type narrowing on messages using messageType anymore unlike in v3

Importing from @sendbird/chat/groupChannel or @sendbird/chat/openChannel throws this error, even after removing node_modules, re-installing and resetting cache.

error: Error: Unable to resolve module @sendbird/chat/groupChannel from /Users/<path-to-my-app>/app/modules/chat/src/Sendbird.ts: @sendbird/chat/groupChannel could not be found within the project or in these directories:
  node_modules

Facing same issue before. i added package.json at sub module dir as workaround.
refs Feature: support new package.json exports field · Issue #670 · facebook/metro · GitHub

diff --git a/node_modules/@sendbird/chat/groupChannel/package.json b/node_modules/@sendbird/chat/groupChannel/package.json
new file mode 100644
index 0000000..3072a6e
--- /dev/null
+++ b/node_modules/@sendbird/chat/groupChannel/package.json
@@ -0,0 +1,22 @@
+{
+  "version": "4.0.0-beta-2",
+  "description": "Sendbird SDK for JavaScript",
+  "name": "@sendbird/chat",
+  "author": "Sendbird <support@sendbird.com>",
+  "keywords": [
+    "sendbird",
+    "sendbird.com",
+    "messaging",
+    "chat",
+    "js"
+  ],
+  "license": "SEE LICENSE IN LICENSE.md",
+  "homepage": "https://sendbird.com",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/sendbird/sendbird-chat-sdk-javascript"
+  },
+  "type": "module",
+  "main": "../bundles/groupChannel.js",
+  "types": "../types/groupChannel.d.ts"
+}
diff --git a/node_modules/@sendbird/chat/message/package.json b/node_modules/@sendbird/chat/message/package.json
new file mode 100644
index 0000000..95e9a3c
--- /dev/null
+++ b/node_modules/@sendbird/chat/message/package.json
@@ -0,0 +1,22 @@
+{
+  "version": "4.0.0-beta-2",
+  "description": "Sendbird SDK for JavaScript",
+  "name": "@sendbird/chat",
+  "author": "Sendbird <support@sendbird.com>",
+  "keywords": [
+    "sendbird",
+    "sendbird.com",
+    "messaging",
+    "chat",
+    "js"
+  ],
+  "license": "SEE LICENSE IN LICENSE.md",
+  "homepage": "https://sendbird.com",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/sendbird/sendbird-chat-sdk-javascript"
+  },
+  "type": "module",
+  "main": "../bundles/message.js",
+  "types": "../types/message.d.ts"
+}
diff --git a/node_modules/@sendbird/chat/openChannel/package.json b/node_modules/@sendbird/chat/openChannel/package.json
new file mode 100644
index 0000000..3072a6e
--- /dev/null
+++ b/node_modules/@sendbird/chat/openChannel/package.json
@@ -0,0 +1,22 @@
+{
+  "version": "4.0.0-beta-2",
+  "description": "Sendbird SDK for JavaScript",
+  "name": "@sendbird/chat",
+  "author": "Sendbird <support@sendbird.com>",
+  "keywords": [
+    "sendbird",
+    "sendbird.com",
+    "messaging",
+    "chat",
+    "js"
+  ],
+  "license": "SEE LICENSE IN LICENSE.md",
+  "homepage": "https://sendbird.com",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/sendbird/sendbird-chat-sdk-javascript"
+  },
+  "type": "module",
+  "main": "../bundles/groupChannel.js",
+  "types": "../types/groupChannel.d.ts"
+}

Thanks for that, I’ll give it a try

@Miyoung_Han, any update on this?