From 457645371f124564e146d92ef5836153e26a1ae3 Mon Sep 17 00:00:00 2001 From: Philipp Melab Date: Sun, 28 Apr 2024 21:02:05 +0200 Subject: [PATCH 1/4] test: reproduce error with monorepo and ui library --- e2e/fixtures/ui-library/index.d.ts | 1 + e2e/fixtures/ui-library/index.js | 6 +++ e2e/fixtures/ui-library/package.json | 19 +++++++ e2e/fixtures/use-ui-library/README.md | 1 + e2e/fixtures/use-ui-library/package.json | 24 +++++++++ .../use-ui-library/src/pages/index.tsx | 11 +++++ e2e/fixtures/use-ui-library/tsconfig.json | 17 +++++++ e2e/use-ui-library.spec.ts | 25 ++++++++++ pnpm-lock.yaml | 49 ++++++++++++++++++- 9 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 e2e/fixtures/ui-library/index.d.ts create mode 100644 e2e/fixtures/ui-library/index.js create mode 100644 e2e/fixtures/ui-library/package.json create mode 100644 e2e/fixtures/use-ui-library/README.md create mode 100644 e2e/fixtures/use-ui-library/package.json create mode 100644 e2e/fixtures/use-ui-library/src/pages/index.tsx create mode 100644 e2e/fixtures/use-ui-library/tsconfig.json create mode 100644 e2e/use-ui-library.spec.ts diff --git a/e2e/fixtures/ui-library/index.d.ts b/e2e/fixtures/ui-library/index.d.ts new file mode 100644 index 000000000..f7ad6a71d --- /dev/null +++ b/e2e/fixtures/ui-library/index.d.ts @@ -0,0 +1 @@ +export function LibraryComponent(): JSX.Element; diff --git a/e2e/fixtures/ui-library/index.js b/e2e/fixtures/ui-library/index.js new file mode 100644 index 000000000..808564b5c --- /dev/null +++ b/e2e/fixtures/ui-library/index.js @@ -0,0 +1,6 @@ +'use client'; +import { createElement } from 'react'; + +export function LibraryComponent() { + return createElement('div', null, 'Library component'); +} diff --git a/e2e/fixtures/ui-library/package.json b/e2e/fixtures/ui-library/package.json new file mode 100644 index 000000000..2e620cf4b --- /dev/null +++ b/e2e/fixtures/ui-library/package.json @@ -0,0 +1,19 @@ +{ + "name": "ui-library", + "version": "1.0.0", + "description": "", + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "keywords": [], + "author": "", + "license": "ISC", + "peerDependencies": { + "react": "19.0.0-canary-e3ebcd54b-20240405", + "react-dom": "19.0.0-canary-e3ebcd54b-20240405" + }, + "devDependencies": { + "@types/react": "18.2.74", + "@types/react-dom": "18.2.24" + } +} diff --git a/e2e/fixtures/use-ui-library/README.md b/e2e/fixtures/use-ui-library/README.md new file mode 100644 index 000000000..534d1691e --- /dev/null +++ b/e2e/fixtures/use-ui-library/README.md @@ -0,0 +1 @@ +# Example that uses a UI library in the same monorepo diff --git a/e2e/fixtures/use-ui-library/package.json b/e2e/fixtures/use-ui-library/package.json new file mode 100644 index 000000000..ccb2ad743 --- /dev/null +++ b/e2e/fixtures/use-ui-library/package.json @@ -0,0 +1,24 @@ +{ + "name": "ssr-target-bundle", + "version": "0.1.0", + "type": "module", + "private": true, + "scripts": { + "dev": "waku dev", + "build": "waku build", + "start": "waku start" + }, + "dependencies": { + "react": "19.0.0-canary-e3ebcd54b-20240405", + "react-dom": "19.0.0-canary-e3ebcd54b-20240405", + "react-server-dom-webpack": "19.0.0-canary-e3ebcd54b-20240405", + "react-textarea-autosize": "8.5.3", + "waku": "workspace:*", + "ui-library": "workspace:*" + }, + "devDependencies": { + "@types/react": "18.2.74", + "@types/react-dom": "18.2.24", + "typescript": "5.4.4" + } +} diff --git a/e2e/fixtures/use-ui-library/src/pages/index.tsx b/e2e/fixtures/use-ui-library/src/pages/index.tsx new file mode 100644 index 000000000..85a476fae --- /dev/null +++ b/e2e/fixtures/use-ui-library/src/pages/index.tsx @@ -0,0 +1,11 @@ +import { LibraryComponent } from 'ui-library'; + +export default async function Test() { + return ; +} + +export async function getConfig() { + return { + render: 'static', + }; +} diff --git a/e2e/fixtures/use-ui-library/tsconfig.json b/e2e/fixtures/use-ui-library/tsconfig.json new file mode 100644 index 000000000..2590e13de --- /dev/null +++ b/e2e/fixtures/use-ui-library/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "composite": true, + "strict": true, + "target": "esnext", + "downlevelIteration": true, + "esModuleInterop": true, + "module": "nodenext", + "skipLibCheck": true, + "noUncheckedIndexedAccess": true, + "exactOptionalPropertyTypes": true, + "types": ["react/experimental"], + "jsx": "react-jsx", + "rootDir": "./src", + "outDir": "./dist" + } +} diff --git a/e2e/use-ui-library.spec.ts b/e2e/use-ui-library.spec.ts new file mode 100644 index 000000000..7d8fce8ff --- /dev/null +++ b/e2e/use-ui-library.spec.ts @@ -0,0 +1,25 @@ +import { execSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; +import { test } from './utils.js'; +import { rm } from 'node:fs/promises'; + +const waku = fileURLToPath( + new URL('../packages/waku/dist/cli.js', import.meta.url), +); + +const cwd = fileURLToPath( + new URL('./fixtures/use-ui-library', import.meta.url), +); + +test.describe(`apps with external ui libraries`, () => { + test.beforeAll('remove cache', async () => { + await rm(`${cwd}/dist`, { + recursive: true, + force: true, + }); + }); + + test('build successfully', async () => { + execSync(`node ${waku} build`, { cwd }); + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3f050ca1..1b94b1cc6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -228,6 +228,53 @@ importers: specifier: 5.4.4 version: 5.4.4 + e2e/fixtures/ui-library: + dependencies: + react: + specifier: 19.0.0-canary-e3ebcd54b-20240405 + version: 19.0.0-canary-e3ebcd54b-20240405 + react-dom: + specifier: 19.0.0-canary-e3ebcd54b-20240405 + version: 19.0.0-canary-e3ebcd54b-20240405(react@19.0.0-canary-e3ebcd54b-20240405) + devDependencies: + '@types/react': + specifier: 18.2.74 + version: 18.2.74 + '@types/react-dom': + specifier: 18.2.24 + version: 18.2.24 + + e2e/fixtures/use-ui-library: + dependencies: + react: + specifier: 19.0.0-canary-e3ebcd54b-20240405 + version: 19.0.0-canary-e3ebcd54b-20240405 + react-dom: + specifier: 19.0.0-canary-e3ebcd54b-20240405 + version: 19.0.0-canary-e3ebcd54b-20240405(react@19.0.0-canary-e3ebcd54b-20240405) + react-server-dom-webpack: + specifier: 19.0.0-canary-e3ebcd54b-20240405 + version: 19.0.0-canary-e3ebcd54b-20240405(react-dom@19.0.0-canary-e3ebcd54b-20240405)(react@19.0.0-canary-e3ebcd54b-20240405)(webpack@5.91.0) + react-textarea-autosize: + specifier: 8.5.3 + version: 8.5.3(@types/react@18.2.74)(react@19.0.0-canary-e3ebcd54b-20240405) + ui-library: + specifier: workspace:* + version: link:../ui-library + waku: + specifier: workspace:* + version: link:../../../packages/waku + devDependencies: + '@types/react': + specifier: 18.2.74 + version: 18.2.74 + '@types/react-dom': + specifier: 18.2.24 + version: 18.2.24 + typescript: + specifier: 5.4.4 + version: 5.4.4 + examples/01_template: dependencies: react: @@ -6036,7 +6083,7 @@ packages: peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: - '@babel/runtime': 7.23.9 + '@babel/runtime': 7.24.4 react: 19.0.0-canary-e3ebcd54b-20240405 use-composed-ref: 1.3.0(react@19.0.0-canary-e3ebcd54b-20240405) use-latest: 1.2.1(@types/react@18.2.74)(react@19.0.0-canary-e3ebcd54b-20240405) From 9462e9a689de96edc8a8ea8362355ea2a97a4b25 Mon Sep 17 00:00:00 2001 From: Philipp Melab Date: Sun, 28 Apr 2024 21:21:01 +0200 Subject: [PATCH 2/4] test: fix it by adding react-server-dom-webpack as a dependency to ui library --- e2e/fixtures/ui-library/package.json | 3 +++ pnpm-lock.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/e2e/fixtures/ui-library/package.json b/e2e/fixtures/ui-library/package.json index 2e620cf4b..41ebc5d2c 100644 --- a/e2e/fixtures/ui-library/package.json +++ b/e2e/fixtures/ui-library/package.json @@ -8,6 +8,9 @@ "keywords": [], "author": "", "license": "ISC", + "dependencies": { + "react-server-dom-webpack": "19.0.0-canary-e3ebcd54b-20240405" + }, "peerDependencies": { "react": "19.0.0-canary-e3ebcd54b-20240405", "react-dom": "19.0.0-canary-e3ebcd54b-20240405" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1b94b1cc6..f15b40adc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -236,6 +236,9 @@ importers: react-dom: specifier: 19.0.0-canary-e3ebcd54b-20240405 version: 19.0.0-canary-e3ebcd54b-20240405(react@19.0.0-canary-e3ebcd54b-20240405) + react-server-dom-webpack: + specifier: 19.0.0-canary-e3ebcd54b-20240405 + version: 19.0.0-canary-e3ebcd54b-20240405(react-dom@19.0.0-canary-e3ebcd54b-20240405)(react@19.0.0-canary-e3ebcd54b-20240405)(webpack@5.91.0) devDependencies: '@types/react': specifier: 18.2.74 From 9cc73f4cd711c28c98b18e2f3f570ea51649b0c6 Mon Sep 17 00:00:00 2001 From: Philipp Melab Date: Tue, 7 May 2024 09:24:47 +0200 Subject: [PATCH 3/4] Revert "test: fix it by adding react-server-dom-webpack as a dependency to ui library" This reverts commit 9462e9a689de96edc8a8ea8362355ea2a97a4b25. --- e2e/fixtures/ui-library/package.json | 3 --- pnpm-lock.yaml | 3 --- 2 files changed, 6 deletions(-) diff --git a/e2e/fixtures/ui-library/package.json b/e2e/fixtures/ui-library/package.json index 41ebc5d2c..2e620cf4b 100644 --- a/e2e/fixtures/ui-library/package.json +++ b/e2e/fixtures/ui-library/package.json @@ -8,9 +8,6 @@ "keywords": [], "author": "", "license": "ISC", - "dependencies": { - "react-server-dom-webpack": "19.0.0-canary-e3ebcd54b-20240405" - }, "peerDependencies": { "react": "19.0.0-canary-e3ebcd54b-20240405", "react-dom": "19.0.0-canary-e3ebcd54b-20240405" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f15b40adc..1b94b1cc6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -236,9 +236,6 @@ importers: react-dom: specifier: 19.0.0-canary-e3ebcd54b-20240405 version: 19.0.0-canary-e3ebcd54b-20240405(react@19.0.0-canary-e3ebcd54b-20240405) - react-server-dom-webpack: - specifier: 19.0.0-canary-e3ebcd54b-20240405 - version: 19.0.0-canary-e3ebcd54b-20240405(react-dom@19.0.0-canary-e3ebcd54b-20240405)(react@19.0.0-canary-e3ebcd54b-20240405)(webpack@5.91.0) devDependencies: '@types/react': specifier: 18.2.74 From b50f6c20b9f236ab563cbceb56e485cb296febf2 Mon Sep 17 00:00:00 2001 From: daishi Date: Wed, 21 Aug 2024 11:45:21 +0900 Subject: [PATCH 4/4] update versions --- e2e/fixtures/ui-library/package.json | 4 +- e2e/fixtures/use-ui-library/package.json | 12 ++--- pnpm-lock.yaml | 62 ++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 8 deletions(-) diff --git a/e2e/fixtures/ui-library/package.json b/e2e/fixtures/ui-library/package.json index 2e620cf4b..50546836c 100644 --- a/e2e/fixtures/ui-library/package.json +++ b/e2e/fixtures/ui-library/package.json @@ -9,8 +9,8 @@ "author": "", "license": "ISC", "peerDependencies": { - "react": "19.0.0-canary-e3ebcd54b-20240405", - "react-dom": "19.0.0-canary-e3ebcd54b-20240405" + "react": "19.0.0-rc-6ebfd5b0-20240818", + "react-dom": "19.0.0-rc-6ebfd5b0-20240818" }, "devDependencies": { "@types/react": "18.2.74", diff --git a/e2e/fixtures/use-ui-library/package.json b/e2e/fixtures/use-ui-library/package.json index ccb2ad743..a73176ac6 100644 --- a/e2e/fixtures/use-ui-library/package.json +++ b/e2e/fixtures/use-ui-library/package.json @@ -9,16 +9,16 @@ "start": "waku start" }, "dependencies": { - "react": "19.0.0-canary-e3ebcd54b-20240405", - "react-dom": "19.0.0-canary-e3ebcd54b-20240405", - "react-server-dom-webpack": "19.0.0-canary-e3ebcd54b-20240405", + "react": "19.0.0-rc-6ebfd5b0-20240818", + "react-dom": "19.0.0-rc-6ebfd5b0-20240818", + "react-server-dom-webpack": "19.0.0-rc-6ebfd5b0-20240818", "react-textarea-autosize": "8.5.3", "waku": "workspace:*", "ui-library": "workspace:*" }, "devDependencies": { - "@types/react": "18.2.74", - "@types/react-dom": "18.2.24", - "typescript": "5.4.4" + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "typescript": "^5.5.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8efe06b51..b2e956c73 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -393,6 +393,22 @@ importers: specifier: ^5.5.4 version: 5.5.4 + e2e/fixtures/ui-library: + dependencies: + react: + specifier: 19.0.0-rc-6ebfd5b0-20240818 + version: 19.0.0-rc-6ebfd5b0-20240818 + react-dom: + specifier: 19.0.0-rc-6ebfd5b0-20240818 + version: 19.0.0-rc-6ebfd5b0-20240818(react@19.0.0-rc-6ebfd5b0-20240818) + devDependencies: + '@types/react': + specifier: 18.2.74 + version: 18.2.74 + '@types/react-dom': + specifier: 18.2.24 + version: 18.2.24 + e2e/fixtures/use-router: dependencies: react: @@ -418,6 +434,37 @@ importers: specifier: ^5.5.4 version: 5.5.4 + e2e/fixtures/use-ui-library: + dependencies: + react: + specifier: 19.0.0-rc-6ebfd5b0-20240818 + version: 19.0.0-rc-6ebfd5b0-20240818 + react-dom: + specifier: 19.0.0-rc-6ebfd5b0-20240818 + version: 19.0.0-rc-6ebfd5b0-20240818(react@19.0.0-rc-6ebfd5b0-20240818) + react-server-dom-webpack: + specifier: 19.0.0-rc-6ebfd5b0-20240818 + version: 19.0.0-rc-6ebfd5b0-20240818(react-dom@19.0.0-rc-6ebfd5b0-20240818(react@19.0.0-rc-6ebfd5b0-20240818))(react@19.0.0-rc-6ebfd5b0-20240818)(webpack@5.93.0) + react-textarea-autosize: + specifier: 8.5.3 + version: 8.5.3(@types/react@18.3.3)(react@19.0.0-rc-6ebfd5b0-20240818) + ui-library: + specifier: workspace:* + version: link:../ui-library + waku: + specifier: workspace:* + version: link:../../../packages/waku + devDependencies: + '@types/react': + specifier: ^18.3.3 + version: 18.3.3 + '@types/react-dom': + specifier: ^18.3.0 + version: 18.3.0 + typescript: + specifier: ^5.5.4 + version: 5.5.4 + examples/01_template: dependencies: react: @@ -1941,9 +1988,15 @@ packages: '@types/prop-types@15.7.12': resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==} + '@types/react-dom@18.2.24': + resolution: {integrity: sha512-cN6upcKd8zkGy4HU9F1+/s98Hrp6D4MOcippK4PoE8OZRngohHZpbJn1GsaDLz87MqvHNoT13nHvNqM9ocRHZg==} + '@types/react-dom@18.3.0': resolution: {integrity: sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==} + '@types/react@18.2.74': + resolution: {integrity: sha512-9AEqNZZyBx8OdZpxzQlaFEVCSFUM2YXJH46yPOiOpm078k6ZLOCcuAzGum/zK8YBwY+dbahVNbHrbgrAwIRlqw==} + '@types/react@18.3.3': resolution: {integrity: sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==} @@ -5786,10 +5839,19 @@ snapshots: '@types/prop-types@15.7.12': {} + '@types/react-dom@18.2.24': + dependencies: + '@types/react': 18.3.3 + '@types/react-dom@18.3.0': dependencies: '@types/react': 18.3.3 + '@types/react@18.2.74': + dependencies: + '@types/prop-types': 15.7.12 + csstype: 3.1.3 + '@types/react@18.3.3': dependencies: '@types/prop-types': 15.7.12