Skip to content

Commit f0082d8

Browse files
Federation (#5)
1 parent 3a90a3a commit f0082d8

File tree

712 files changed

+82476
-739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

712 files changed

+82476
-739
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: E2E Tests
1+
name: Build Test
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
e2e-tests:
10+
build-test:
1111
runs-on: ubuntu-latest
1212

1313
steps:
@@ -40,6 +40,12 @@ jobs:
4040
4141
- name: Install dependencies
4242
run: pnpm install
43+
44+
- name: Build package
45+
run: pnpm build
46+
47+
- name: Run publint
48+
run: npx publint --errors-only
4349

4450
- name: Install Playwright browsers
4551
run: npx playwright install --with-deps chromium

.prettierignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build artifacts
2+
dist/
3+
node_modules/
4+
.git/
5+
.vscode/
6+
.idea/
7+
8+
# Examples directory (not our focus)
9+
examples/
10+
11+
# Test files (only focusing on src)
12+
tests/
13+
14+
# Coverage reports
15+
coverage/
16+
17+
# Lock files
18+
pnpm-lock.yaml
19+
package-lock.json
20+
yarn.lock

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 80,
7+
"arrowParens": "avoid",
8+
"endOfLine": "lf"
9+
}

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export default defineConfig(() => {
4141
pluginReactRouter({
4242
// Optional: Enable custom server mode
4343
customServer: false,
44+
// Optional: Specify server output format
45+
serverOutput: "commonjs",
46+
//Optional: enable experimental support for module federation
47+
federation: false
4448
}),
4549
pluginReact()
4650
],
@@ -60,7 +64,19 @@ pluginReactRouter({
6064
* Enable this when you want to handle server setup manually.
6165
* @default false
6266
*/
63-
customServer?: boolean
67+
customServer?: boolean,
68+
69+
/**
70+
* Specify the output format for server-side code.
71+
* Options: "commonjs" | "module"
72+
* @default "module"
73+
*/
74+
serverOutput?: "commonjs" | "module"
75+
/**
76+
* Enable experimental support for module federation
77+
* @default false
78+
*/
79+
federation?: boolean
6480
})
6581
```
6682

examples/cloudflare/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"@cloudflare/workers-types": "^4.20241112.0",
2222
"@react-router/cloudflare": "^7.4.0",
2323
"@react-router/dev": "^7.4.0",
24-
"@rsbuild/core": "^1.2.3",
25-
"@rsbuild/plugin-react": "^1.1.0",
24+
"@rsbuild/core": "^1.2.19",
25+
"@rsbuild/plugin-react": "^1.1.1",
2626
"@rsbuild/plugin-react-router": "workspace:*",
2727
"@tailwindcss/postcss": "^4.0.0",
2828
"@types/node": "^20",

examples/custom-node-server/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"dev": "RSDOCTOR=false node server.js",
99
"start": "NODE_ENV=production node server.js",
1010
"build": "rsbuild build",
11-
"typecheck": "react-router typegen && tsc"
11+
"typecheck": "react-router typegen && tsc",
12+
"test:e2e": "pnpm run dev & sleep 5 && playwright test",
13+
"test:e2e:debug": "playwright test --debug",
14+
"test:e2e:ui": "playwright test --ui"
1215
},
1316
"keywords": [],
1417
"author": "",
@@ -23,9 +26,10 @@
2326
"react-router": "^7.4.0"
2427
},
2528
"devDependencies": {
29+
"@playwright/test": "^1.50.1",
2630
"@react-router/dev": "^7.4.0",
27-
"@rsbuild/core": "^1.2.3",
28-
"@rsbuild/plugin-react": "^1.1.0",
31+
"@rsbuild/core": "^1.2.19",
32+
"@rsbuild/plugin-react": "^1.1.1",
2933
"@rsbuild/plugin-react-router": "workspace:*",
3034
"@rsdoctor/rspack-plugin": "^0.4.13",
3135
"@types/express": "^5.0.0",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
testDir: './tests/e2e',
5+
// Maximum time one test can run for
6+
timeout: 30 * 1000,
7+
expect: {
8+
timeout: 5000
9+
},
10+
// Run tests in files in parallel
11+
fullyParallel: false,
12+
// Fail the build on CI if you accidentally left test.only in the source code
13+
forbidOnly: !!process.env.CI,
14+
// Retry on CI only
15+
retries: process.env.CI ? 2 : 0,
16+
17+
// Shared settings for all the projects below
18+
use: {
19+
// Base URL to use in actions like `await page.goto('/')`
20+
baseURL: 'http://localhost:3000',
21+
22+
// Collect trace when retrying the failed test
23+
trace: 'on-first-retry',
24+
25+
// Take screenshot on test failure
26+
screenshot: 'only-on-failure',
27+
},
28+
29+
// Configure only Chrome desktop browser
30+
projects: [
31+
{
32+
name: 'chromium',
33+
use: { ...devices['Desktop Chrome'] },
34+
},
35+
]
36+
});

examples/custom-node-server/server/app.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/custom-node-server/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ declare module 'react-router' {
77
}
88
}
99

10-
export const index = createRequestHandler({
10+
export const app = createRequestHandler({
1111
// @ts-expect-error - virtual module provided by React Router at build time
1212
build: () => import('virtual/react-router/server-build'),
1313
getLoadContext() {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"status": "passed",
3+
"failedTests": []
4+
}

0 commit comments

Comments
 (0)