From 44546a92831855f42a41a916d97eaf8d027ade8a Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich Date: Wed, 15 Apr 2026 13:09:40 +0200 Subject: [PATCH] feat: support React 19 in ESM build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update @cognigy/chat-components to 0.70.0 which externalizes react/jsx-runtime to prevent React 19 crashes (ReactCurrentOwner removed in React 19). Add react-dom/client, react/jsx-runtime, and react/jsx-dev-runtime to the ESM build externals so consumers provide their own React subpath modules. This enables React 19 consumers (e.g. Interaction Panel MFE via Module Federation) to load the ESM bundle without crashes from bundled React 18 internals. UMD build (webchat.js) is unaffected — it continues to bundle everything inline. Co-Authored-By: Claude Opus 4.6 (1M context) --- package-lock.json | 8 ++++---- package.json | 6 +++--- webpack.es.js | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 370ed6f0..0abd3794 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "SEE LICENSE IN LICENSE", "dependencies": { "@braintree/sanitize-url": "^6.0.0", - "@cognigy/chat-components": "0.69.0", + "@cognigy/chat-components": "0.70.0", "@cognigy/socket-client": "5.0.0-beta.26", "@emotion/cache": "^10.0.29", "@emotion/react": "^11.13.0", @@ -1902,9 +1902,9 @@ } }, "node_modules/@cognigy/chat-components": { - "version": "0.69.0", - "resolved": "https://registry.npmjs.org/@cognigy/chat-components/-/chat-components-0.69.0.tgz", - "integrity": "sha512-vIiNF4QdaIgffNirZuSMmyN3Rm6kwbHVIuVCaWasuiUISkoPqYHqWciXKEsB2JniguYobaXu0jGj0nQHJTvvrw==", + "version": "0.70.0", + "resolved": "https://registry.npmjs.org/@cognigy/chat-components/-/chat-components-0.70.0.tgz", + "integrity": "sha512-5XwkUC71Dksii4Ba8EGQSLLm5IoifWURrm2VxxRQn0Lh+UWNpH/ExQS8KmDiirXYqe2O99EH4v5B7IE5NtE3Qg==", "dependencies": { "@braintree/sanitize-url": "^7.1.1", "@fontsource/figtree": "5.2.10", diff --git a/package.json b/package.json index cc949747..ea01d2dd 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "dependencies": { "@braintree/sanitize-url": "^6.0.0", - "@cognigy/chat-components": "0.69.0", + "@cognigy/chat-components": "0.70.0", "@cognigy/socket-client": "5.0.0-beta.26", "@emotion/cache": "^10.0.29", "@emotion/react": "^11.13.0", @@ -95,6 +95,8 @@ "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", "@babel/runtime": "^7.16.7", + "@eslint/js": "^9.0.0", + "@redux-devtools/extension": "^3.3.0", "@svgr/webpack": "8.1.0", "@types/dom-speech-recognition": "0.0.4", "@types/dompurify": "^2.0.0", @@ -107,7 +109,6 @@ "@types/tinycolor2": "^1.4.3", "@types/uuid": "^3.4.6", "@types/whatwg-fetch": "0.0.33", - "@eslint/js": "^9.0.0", "@typescript-eslint/eslint-plugin": "^8.0.0", "@typescript-eslint/parser": "^8.0.0", "babel-loader": "^8.2.3", @@ -126,7 +127,6 @@ "prettier": "^3.5.3", "react": "^18.3.0", "react-dom": "^18.3.0", - "@redux-devtools/extension": "^3.3.0", "style-loader": "^3.3.1", "terser-webpack-plugin": "^5.3.0", "typesafe-actions": "^3.0.0", diff --git a/webpack.es.js b/webpack.es.js index 047cbf89..948ebe0f 100644 --- a/webpack.es.js +++ b/webpack.es.js @@ -49,6 +49,9 @@ config.externalsType = "module"; config.externals = { react: "react", "react-dom": "react-dom", + "react-dom/client": "react-dom/client", + "react/jsx-runtime": "react/jsx-runtime", + "react/jsx-dev-runtime": "react/jsx-dev-runtime", }; config.plugins.push(