Skip to content

Commit fcbae83

Browse files
fix: patch chunk split of "_partial" container entry (#2353)
Co-authored-by: ScriptedAlchemy <[email protected]>
1 parent bc5c2e0 commit fcbae83

File tree

23 files changed

+126
-39
lines changed

23 files changed

+126
-39
lines changed

.changeset/purple-apples-battle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/rspack': patch
3+
---
4+
5+
patch chunk split of partial container entry

.changeset/strong-grapes-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/enhanced': patch
3+
---
4+
5+
patch chunk split of "\_partial" container chunks

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,35 @@ jobs:
4646
- name: Run Affected Test
4747
run: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg'
4848

49-
- name: E2E Test for Next.js
50-
run: pnpm run app:next:dev & echo "done" && npx wait-on tcp:3000 && npx wait-on tcp:3001 && npx wait-on tcp:3002 && npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=2 && lsof -ti tcp:3000,3001,3002 | xargs kill
51-
52-
# - name: E2E Test for 3001-shop
53-
# run: pnpm run app:next:dev & echo "done" && sleep 20 && npx nx run-many --target=test:e2e --projects=3001-shop && lsof -ti tcp:3000,3001,3002 | xargs kill
49+
- name: E2E Test for Next.js Dev
50+
run: |
51+
pnpm run app:next:dev > /dev/null 2>&1 &
52+
sleep 1 &&
53+
npx wait-on tcp:3001 &&
54+
npx wait-on tcp:3002 &&
55+
npx wait-on tcp:3000 &&
56+
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=3 &&
57+
lsof -ti tcp:3000,3001,3002 | xargs kill
58+
59+
- name: E2E Test for Next.js Prod
60+
run: |
61+
pnpm run --filter @module-federation/3002-checkout --filter @module-federation/3000-home --filter @module-federation/3001-shop build &&
62+
pnpm run app:next:prod &
63+
sleep 2 &&
64+
npx wait-on tcp:3001 &&
65+
npx wait-on tcp:3002 &&
66+
npx wait-on tcp:3000 &&
67+
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=3 &&
68+
lsof -ti tcp:3000,3001,3002 | xargs kill
5469
5570
- name: E2E Test for ModernJS
5671
run: npx nx run-many --target=test:e2e --projects=modernjs --parallel=1 && lsof -ti tcp:4001 | xargs kill
5772

58-
# - name: E2E Test for 3002-checkout
59-
# run: pnpm run app:next:dev & echo "done" && sleep 15 && npx nx run-many --target=test:e2e --projects=3002-checkout && lsof -ti tcp:3000,3001,3002 | xargs kill
60-
6173
- name: E2E Test for 3005-runtime-host
6274
run: pnpm run app:runtime:dev & echo "done" && sleep 20 && npx nx run-many --target=test:e2e --projects=3005-runtime-host --parallel=1 && lsof -ti tcp:3005,3006,3007 | xargs kill
6375

6476
- name: E2E Test for 3008-webpack-host
65-
run: pnpm run app:manifest:dev & echo "done" && sleep 6 && npx nx run-many --target=e2e --projects=3008-webpack-host --parallel=1 && lsof -ti tcp:3008,3009,3010,3011,3012 | xargs kill
66-
67-
- name: Build Next.js Apps in Production Mode
68-
run: pnpm app:next:build
77+
run: pnpm run app:manifest:dev & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx nx run-many --target=e2e --projects=3008-webpack-host --parallel=1 && lsof -ti tcp:3008,3009,3010,3011,3012 | xargs kill
6978

7079
- name: E2E Node Federation
7180
run: npx nx run-many --target=serve --projects=node-local-remote,node-remote --parallel=3 & echo "done" && sleep 10 && npx nx run-many --target=serve --projects=node-host & npx wait-on tcp:3333 && npx nx run node-host-e2e:test:e2e

apps/3000-home/cypress/e2e/app.cy.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@ import { getH1, getH3 } from '../support/app.po';
33
describe('3000-home/', () => {
44
beforeEach(() => cy.visit('/'));
55

6+
describe('Warmup Next', () => {
7+
it('warms pages concurrently', () => {
8+
const urls = [
9+
'/shop',
10+
'/checkout',
11+
'/checkout/test-title',
12+
'/checkout/test-check-button',
13+
];
14+
urls.forEach((url) => {
15+
cy.request(url); // This makes a GET request, not a full page visit
16+
});
17+
});
18+
});
19+
620
describe('Welcome message', () => {
721
it('should display welcome message', () => {
822
getH1().contains('This is SPA combined');
@@ -32,9 +46,6 @@ describe('3000-home/', () => {
3246

3347
describe('Routing checks', () => {
3448
it('check that clicking back and forwards in client side routeing still renders the content correctly', () => {
35-
cy.visit('/');
36-
cy.visit('/shop');
37-
cy.visit('/');
3849
cy.visit('/shop');
3950
cy.wait(3000);
4051
cy.url().should('include', '/shop');

apps/3000-home/next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const nextConfig = {
4242
},
4343
shared: {
4444
'lodash/': {},
45-
'antd/': {},
45+
antd: {},
4646
},
4747
extraOptions: {
4848
debug: false,

apps/3000-home/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@module-federation/utilities": "workspace:*"
3636
},
3737
"scripts": {
38-
"start": "next start"
38+
"start": "next start",
39+
"build": "pnpm exec next telemetry disable && NEXT_PRIVATE_LOCAL_WEBPACK=true next build"
3940
}
4041
}

apps/3001-shop/cypress/e2e/app.cy.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ describe('3001-shop/', () => {
55
cy.visit('/');
66
});
77

8+
describe('Warmup Next', () => {
9+
it('warms pages concurrently', () => {
10+
const urls = [
11+
'/shop',
12+
'/checkout',
13+
'/checkout/test-title',
14+
'/checkout/test-check-button',
15+
];
16+
urls.forEach((url) => {
17+
cy.request(url); // This makes a GET request, not a full page visit
18+
});
19+
});
20+
});
21+
822
describe('Welcome message', () => {
923
it('should display welcome message', () => {
1024
getH1().contains('This is SPA combined');
@@ -33,8 +47,7 @@ describe('3001-shop/', () => {
3347
});
3448

3549
describe('Routing checks', () => {
36-
xit('check that clicking back and forwards in client-side routing still renders the content correctly', () => {
37-
cy.visit('/');
50+
it('check that clicking back and forwards in client-side routing still renders the content correctly', () => {
3851
cy.visit('/shop');
3952
cy.url().should('include', '/shop');
4053
cy.wait(3000);

apps/3001-shop/next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const nextConfig = {
3434
},
3535
shared: {
3636
'lodash/': {},
37-
'antd/': {},
37+
antd: {},
3838
},
3939
extraOptions: {
4040
exposePages: true,

apps/3001-shop/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@module-federation/utilities": "workspace:*"
3636
},
3737
"scripts": {
38-
"start": "next start"
38+
"start": "next start",
39+
"build": "NEXT_PRIVATE_LOCAL_WEBPACK=true next build"
3940
}
4041
}

apps/3001-shop/pages/shop/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ Shop.getInitialProps = async () => {
7676
],
7777
created: '2014-12-09T13:50:51.644000Z',
7878
edited: '2014-12-20T21:17:56.891000Z',
79-
url: 'https://swapi.dev/api/people/1/',
8079
};
8180

82-
const timerPromise = timeout(3000).then(() => fallback);
81+
const timerPromise = timeout(500).then(() => fallback);
8382

8483
return Promise.race([timerPromise]);
8584
};

0 commit comments

Comments
 (0)