Skip to content

Commit 9cd3bce

Browse files
chore: merge feat/exp-flag-alias-consumption
2 parents 2e0009b + 9a8b9f6 commit 9cd3bce

File tree

128 files changed

+4193
-3295
lines changed

Some content is hidden

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

128 files changed

+4193
-3295
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@module-federation/enhanced': patch
3+
---
4+
5+
fix(enhanced): ConsumeSharedPlugin alias-aware and virtual resource handling
6+
7+
- Skip `data:` (virtual) resources in `afterResolve` and `createModule` so webpack's scheme resolver handles them (fixes container virtual-entry compile failure)
8+
- Broaden alias-aware matching in `afterResolve` to include deep-path shares that start with the resolved package name (e.g. `next/dist/compiled/react`), ensuring aliased modules are consumed from federation when configured
9+
- Avoid converting explicit relative/absolute requests into consumes to preserve local nested resolution (fixes deep module sharing version selection)
10+
- Keep prefix and node_modules suffix matching intact; no behavior change there
11+
12+
These changes restore expected behavior for:
13+
- Virtual entry compilation
14+
- Deep module sharing (distinct versions for nested paths)
15+
- Alias-based sharing (Next.js compiled React)
16+

.changeset/wet-pants-sniff.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
"@module-federation/cli": patch
3+
"@module-federation/data-prefetch": patch
4+
"@module-federation/error-codes": patch
5+
"@module-federation/managers": patch
6+
"@module-federation/manifest": patch
7+
"@module-federation/rsbuild-plugin": patch
8+
"@module-federation/rspack": patch
9+
"@module-federation/runtime": patch
10+
"@module-federation/runtime-core": patch
11+
"@module-federation/inject-external-runtime-core-plugin": patch
12+
"@module-federation/runtime-tools": patch
13+
"@module-federation/sdk": patch
14+
"@module-federation/utilities": patch
15+
"@module-federation/webpack-bundler-runtime": patch
16+
---
17+
18+
use TSC instead of SWC

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: pnpm install
5050

5151
- name: Clear Node Modules Cache
52-
run: rm -rf node_modules/.cache
52+
run: find . -maxdepth 6 -type d \( -name ".cache" -o -name ".modern-js" \) -exec rm -rf {} +
5353

5454
- name: Install Cypress
5555
# if: steps.browsers-cache.outputs.cache-hit != 'true'
@@ -87,18 +87,12 @@ jobs:
8787
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4
8888

8989
- name: Run Affected Test
90-
uses: nick-fields/retry@v3
91-
with:
92-
max_attempts: 2
93-
timeout_minutes: 10
94-
command: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg'
90+
timeout-minutes: 10
91+
run: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg'
9592

9693
- name: Run Affected Experimental Tests
97-
uses: nick-fields/retry@v3
98-
with:
99-
max_attempts: 2
100-
timeout_minutes: 10
101-
command: npx nx affected -t test:experiments --parallel=1 --exclude='*,!tag:type:pkg' --skip-nx-cache
94+
timeout-minutes: 10
95+
run: npx nx affected -t test:experiments --parallel=1 --exclude='*,!tag:type:pkg' --skip-nx-cache
10296

10397
e2e-modern:
10498
needs: checkout-install

.github/workflows/devtools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
uses: nrwl/nx-set-shas@v3
4848

4949
- name: Install Dependencies
50-
run: pnpm install && rm -rf ./node_modules/.cache
50+
run: pnpm install && find . -maxdepth 6 -type d \( -name ".cache" -o -name ".modern-js" \) -exec rm -rf {} +
5151

5252
- name: Install Cypress
5353
run: npx cypress install

.github/workflows/e2e-manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646

4747
- name: E2E Test for Manifest Demo Development
4848
if: steps.check-ci.outcome == 'success'
49-
run: pnpm run app:manifest:dev & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx wait-on http://127.0.0.1:4001/ && npx nx run-many --target=e2e --projects=manifest-webpack-host --parallel=2 && npx kill-port 3013 3009 3010 3011 3012 4001
49+
run: node tools/scripts/run-manifest-e2e.mjs --mode=dev
5050

5151
- name: E2E Test for Manifest Demo Production
5252
if: steps.check-ci.outcome == 'success'
53-
run: pnpm run app:manifest:prod & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx wait-on http://127.0.0.1:4001/ && npx nx run-many --target=e2e --projects=manifest-webpack-host --parallel=1 && npx kill-port 3013 3009 3010 3011 3012 4001
53+
run: node tools/scripts/run-manifest-e2e.mjs --mode=prod

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ apps/**/dist
5555
**/cypress/downloads
5656

5757
# test cases
58-
!packages/enhanced/test/configCases/**/**/node_modules
5958
packages/enhanced/test/js
6059
.ignored
6160
**/.mf
@@ -91,7 +90,13 @@ ssg
9190
# Native binary files
9291
*.node
9392

94-
9593
# Ignore local worktrees
9694
worktrees/
9795

96+
__mocks__/
97+
98+
# test mock modules
99+
# Keep ALL test configCases node_modules (and all nested files) tracked,
100+
# so we don't need per-path exceptions like next/dist.
101+
!packages/enhanced/test/configCases/**/node_modules/
102+
!packages/enhanced/test/configCases/**/node_modules/**

AGENTS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# AGENTS.md - Module Federation Core Repository Guidelines
2+
3+
## Build/Test Commands
4+
```bash
5+
pnpm build # Build all packages (tag:type:pkg)
6+
pnpm test # Run all tests via nx
7+
pnpm lint # Lint all packages
8+
pnpm lint-fix # Fix linting issues
9+
pnpm nx run <pkg>:test # Test specific package
10+
npx jest path/to/test.ts --no-coverage # Run single test file
11+
```
12+
13+
## Code Style
14+
- **Imports**: External → SDK/core → Local (grouped with blank lines)
15+
- **Type imports**: `import type { ... }` explicitly marked
16+
- **Naming**: camelCase functions, PascalCase classes, SCREAMING_SNAKE constants
17+
- **Files**: kebab-case or PascalCase for class files
18+
- **Errors**: Use `@module-federation/error-codes`, minimal try-catch
19+
- **Comments**: Minimal, use `//` inline, `/** */` for deprecation
20+
- **Async**: Named async functions for major ops, arrow functions in callbacks
21+
- **Exports**: Named exports preferred, barrel exports in index files
22+
- **Package manager**: ALWAYS use pnpm, never npm
23+
- **Parallelization**: Break tasks into 3-10 parallel subtasks minimum
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Button from 'antd/lib/button';
2-
import { version } from 'antd/package.json';
2+
import antdPackage from 'antd/package.json';
33
import stuff from './stuff.module.css';
4+
5+
const { version } = antdPackage;
46
export default function ButtonOldAnt() {
57
return <Button className={stuff.test}>Button from antd@{version}</Button>;
68
}

apps/manifest-demo/3010-rspack-provider/src/components/ButtonOldAnt.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import Button from 'antd/lib/button';
2-
import { version } from 'antd/package.json';
2+
import antdPackage from 'antd/package.json';
33
import * as stuff from './stuff.module.css';
44

5+
const { version } = antdPackage;
6+
57
export default function ButtonOldAnt() {
68
return (
79
// @ts-ignore
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import Button from 'antd/lib/button';
2-
import { version } from 'antd/package.json';
2+
import antdPackage from 'antd/package.json';
33
import stuff from './stuff.module.css';
44

5+
const { version } = antdPackage;
6+
57
export default function ButtonOldAnt() {
68
return <Button className={stuff.test}>Button from antd@{version}</Button>;
79
}

0 commit comments

Comments
 (0)