Skip to content

Commit c399b9a

Browse files
perf: switch to ESM by default (#3688)
1 parent 451b4f5 commit c399b9a

Some content is hidden

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

52 files changed

+865
-190
lines changed

.changeset/gold-bottles-promise.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@module-federation/inject-external-runtime-core-plugin': minor
3+
'@module-federation/webpack-bundler-runtime': minor
4+
'@module-federation/data-prefetch': minor
5+
'@module-federation/runtime-tools': minor
6+
'@module-federation/runtime-core': minor
7+
'@module-federation/enhanced': minor
8+
'bundle-size': minor
9+
'@module-federation/runtime': minor
10+
'@module-federation/node': minor
11+
'@module-federation/sdk': minor
12+
'@module-federation/esbuild': patch
13+
---
14+
15+
Switch to esm modules by default

.cursorignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@
55
**/dist/
66

77
# Documentation and config files
8-
**/*.md
98
**/*.yaml
109
**/*.yml
11-
**/.eslintrc*
12-
**/.prettierrc*
13-
**/.swcrc
14-
**/jest.config.*
15-
**/tsconfig.*
16-
**/*/stats.json
10+
1711

1812
# Explicitly ignore specific packages
1913
packages/typescript/
@@ -24,7 +18,6 @@ packages/native-federation-typescript/
2418
packages/esbuild/
2519

2620
# Ignore specific directories
27-
apps/
2821
webpack/tooling/
2922
webpack/setup/
3023
webpack/test/
@@ -35,7 +28,7 @@ tools/
3528
.vscode/
3629
.verdaccio/
3730

38-
!apps/manifest-demo/*.ts
31+
3932

4033
# Ignore specific files
4134
.cursorignore

apps/bundle-size/.babelrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"presets": [
3+
[
4+
"@nx/react/babel",
5+
{
6+
"runtime": "automatic"
7+
}
8+
]
9+
],
10+
"plugins": []
11+
}

apps/bundle-size/cypress.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
2+
import { defineConfig } from 'cypress';
3+
4+
export default defineConfig({
5+
e2e: nxE2EPreset(__filename, { cypressDir: 'cypress' }),
6+
defaultCommandTimeout: 20000,
7+
});
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { getH1, getH3 } from '../support/app.po';
2+
3+
describe('3005-runtime-host/', () => {
4+
beforeEach(() => cy.visit('/'));
5+
6+
describe('Welcome message', () => {
7+
it('should display welcome message', () => {
8+
getH1().contains('Runtime Demo');
9+
});
10+
});
11+
12+
describe('Image checks', () => {
13+
it('should check that the home-webpack-png and remote1-webpack-png images are not 404', () => {
14+
// Get the src attribute of the home-webpack-png image
15+
cy.get('img.home-webpack-png')
16+
.invoke('attr', 'src')
17+
.then((src) => {
18+
if (!src) {
19+
throw new Error('src must not be empty');
20+
}
21+
cy.log(src);
22+
cy.request(src).its('status').should('eq', 200);
23+
});
24+
25+
// Get the src attribute of the shop-webpack-png image
26+
cy.get('img.remote1-webpack-png')
27+
.invoke('attr', 'src')
28+
.then((src) => {
29+
if (!src) {
30+
throw new Error('src must not be empty');
31+
}
32+
// Send a GET request to the src URL
33+
cy.request(src).its('status').should('eq', 200);
34+
});
35+
});
36+
37+
it('should check that the home-webpack-svg and remote1-webpack-svg images are not 404', () => {
38+
// Get the src attribute of the home-webpack-png image
39+
cy.get('img.home-webpack-svg')
40+
.invoke('attr', 'src')
41+
.then((src) => {
42+
if (!src) {
43+
throw new Error('src must not be empty');
44+
}
45+
cy.log(src);
46+
cy.request(src).its('status').should('eq', 200);
47+
});
48+
49+
// Get the src attribute of the shop-webpack-png image
50+
cy.get('img.remote1-webpack-svg')
51+
.invoke('attr', 'src')
52+
.then((src) => {
53+
if (!src) {
54+
throw new Error('src must not be empty');
55+
}
56+
// Send a GET request to the src URL
57+
cy.request(src).its('status').should('eq', 200);
58+
});
59+
});
60+
});
61+
62+
describe('Shared react hook check', () => {
63+
it('should display text which comes from remote1 hook', () => {
64+
cy.get('.remote1-text')
65+
.invoke('html')
66+
.should('equal', 'Custom hook from localhost:3006 works!');
67+
});
68+
});
69+
70+
describe('dynamic remote check', () => {
71+
describe('dynamic-remote/ButtonOldAnt', () => {
72+
it('should display remote button', () => {
73+
cy.get('button.test-remote2').contains('Button');
74+
});
75+
it('should use host shared(antd)', () => {
76+
cy.get('button.test-remote2').contains('Button from antd@4.24.15');
77+
});
78+
});
79+
});
80+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "hello@cypress.io",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const getH1 = () => cy.get('h1');
2+
export const getH2 = () => cy.get('h2');
3+
export const getH3 = () => cy.get('h3');
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// <reference types="cypress" />
2+
3+
// ***********************************************
4+
// This example commands.ts shows you how to
5+
// create various custom commands and overwrite
6+
// existing commands.
7+
//
8+
// For more comprehensive examples of custom
9+
// commands please read more here:
10+
// https://on.cypress.io/custom-commands
11+
// ***********************************************
12+
13+
// eslint-disable-next-line @typescript-eslint/no-namespace
14+
declare namespace Cypress {
15+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
16+
interface Chainable<Subject> {
17+
login(email: string, password: string): void;
18+
}
19+
}
20+
21+
// -- This is a parent command --
22+
Cypress.Commands.add('login', (email, password) => {
23+
// console.log('Custom command example: Login', email, password);
24+
});
25+
//
26+
// -- This is a child command --
27+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
28+
//
29+
//
30+
// -- This is a dual command --
31+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
32+
//
33+
//
34+
// -- This will overwrite an existing command --
35+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.ts is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.ts using ES2015 syntax:
17+
import './commands';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"outDir": "../../dist/out-tsc",
6+
"module": "commonjs",
7+
"types": ["cypress", "node"],
8+
"sourceMap": false
9+
},
10+
"include": [
11+
"**/*.ts",
12+
"**/*.js",
13+
"../cypress.config.ts",
14+
"../**/*.cy.ts",
15+
"../**/*.cy.tsx",
16+
"../**/*.cy.js",
17+
"../**/*.cy.jsx",
18+
"../**/*.d.ts"
19+
]
20+
}

0 commit comments

Comments
 (0)