diff --git a/package-lock.json b/package-lock.json index 710844a5..4fcce96e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -828,9 +828,9 @@ "integrity": "sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==" }, "node_modules/@lit/react": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.2.tgz", - "integrity": "sha512-UJ5TQ46DPcJDIzyjbwbj6Iye0XcpCxL2yb03zcWq1BpWchpXS3Z0BPVhg7zDfZLF6JemPml8u/gt/+KwJ/23sg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.3.tgz", + "integrity": "sha512-RGoPMrAPbFjQFXFbfmYdotw000DyChehTim+d562HRXvFGw//KxouI8jNOcc3Kw/1uqUA1SJqXFtKKxK0NUrww==", "peerDependencies": { "@types/react": "17 || 18" } @@ -5552,7 +5552,7 @@ "version": "1.7.0", "license": "MIT", "dependencies": { - "@lit/react": "^1.0.2", + "@lit/react": "^1.0.3", "@theoplayer/web-ui": "^1.7.0" }, "devDependencies": { @@ -5928,9 +5928,9 @@ "integrity": "sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==" }, "@lit/react": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.2.tgz", - "integrity": "sha512-UJ5TQ46DPcJDIzyjbwbj6Iye0XcpCxL2yb03zcWq1BpWchpXS3Z0BPVhg7zDfZLF6JemPml8u/gt/+KwJ/23sg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.3.tgz", + "integrity": "sha512-RGoPMrAPbFjQFXFbfmYdotw000DyChehTim+d562HRXvFGw//KxouI8jNOcc3Kw/1uqUA1SJqXFtKKxK0NUrww==", "requires": {} }, "@mole-inc/bin-wrapper": { @@ -6171,7 +6171,7 @@ "@theoplayer/react-ui": { "version": "file:react", "requires": { - "@lit/react": "^1.0.2", + "@lit/react": "^1.0.3", "@rollup/plugin-node-resolve": "^15.2.1", "@rollup/plugin-replace": "^5.0.5", "@swc/cli": "^0.1.62", @@ -6572,9 +6572,9 @@ "integrity": "sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==" }, "@lit/react": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.2.tgz", - "integrity": "sha512-UJ5TQ46DPcJDIzyjbwbj6Iye0XcpCxL2yb03zcWq1BpWchpXS3Z0BPVhg7zDfZLF6JemPml8u/gt/+KwJ/23sg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.3.tgz", + "integrity": "sha512-RGoPMrAPbFjQFXFbfmYdotw000DyChehTim+d562HRXvFGw//KxouI8jNOcc3Kw/1uqUA1SJqXFtKKxK0NUrww==", "requires": {} }, "@mole-inc/bin-wrapper": { @@ -6815,7 +6815,7 @@ "@theoplayer/react-ui": { "version": "file:react", "requires": { - "@lit/react": "^1.0.2", + "@lit/react": "^1.0.3", "@rollup/plugin-node-resolve": "^15.2.1", "@rollup/plugin-replace": "^5.0.5", "@swc/cli": "^0.1.62", diff --git a/react/CHANGELOG.md b/react/CHANGELOG.md index 993065d7..e8795281 100644 --- a/react/CHANGELOG.md +++ b/react/CHANGELOG.md @@ -10,6 +10,10 @@ > - 🏠 Internal > - 💅 Polish +## Unreleased + +- 🐛 Fix "Warning: useLayoutEffect does nothing on the server" when using `@theoplayer/react-ui` in Node. ([#52](https://github.com/THEOplayer/web-ui/pull/52)) + ## v1.7.0 (2024-02-15) - 🚀 Added support for loading in Node for static site generation (SSG) or server-side rendering (SSR). ([#50](https://github.com/THEOplayer/web-ui/pull/50)) diff --git a/react/package.json b/react/package.json index 0ab4757c..dfc12632 100644 --- a/react/package.json +++ b/react/package.json @@ -49,7 +49,7 @@ "directory": "react" }, "dependencies": { - "@lit/react": "^1.0.2", + "@lit/react": "^1.0.3", "@theoplayer/web-ui": "^1.7.0" }, "peerDependencies": { diff --git a/react/rollup.config.mjs b/react/rollup.config.mjs index 0db001ab..12a376a0 100644 --- a/react/rollup.config.mjs +++ b/react/rollup.config.mjs @@ -17,11 +17,18 @@ const banner = `/*! * THEOplayer Open Video UI for React (v${version}) * License: ${license} */`; -const externals = { +const globals = { react: 'React', '@theoplayer/web-ui': 'THEOplayerUI', '@theoplayer/web-ui/es5': 'THEOplayerUI' }; +const external = Object.keys(globals); +const esmExternal = [ + ...external, + // @lit-react has a separate entry point for Node, to support SSR. + // Don't bundle it ourselves, otherwise we'll always ship the browser version. + '@lit/react' +]; /** * @param {{configOutputDir?: string}} cliArgs @@ -60,10 +67,10 @@ function jsConfig(outputDir, { es5 = false, production = false, sourcemap = fals sourcemap, indent: false, banner, - globals: externals + globals }, context: 'self', - external: Object.keys(externals), + external, plugins: jsPlugins({ es5, module: false, production, sourcemap }) }, { @@ -75,7 +82,7 @@ function jsConfig(outputDir, { es5 = false, production = false, sourcemap = fals indent: false }, context: 'self', - external: Object.keys(externals), + external: esmExternal, plugins: jsPlugins({ es5, module: true, production, sourcemap }) } ]);