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..50546836c --- /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-rc-6ebfd5b0-20240818", + "react-dom": "19.0.0-rc-6ebfd5b0-20240818" + }, + "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..a73176ac6 --- /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-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.3.3", + "@types/react-dom": "^18.3.0", + "typescript": "^5.5.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 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