Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/wet-pants-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"@module-federation/cli": patch
"@module-federation/data-prefetch": patch
"@module-federation/error-codes": patch
"@module-federation/managers": patch
"@module-federation/manifest": patch
"@module-federation/rsbuild-plugin": patch
"@module-federation/rspack": patch
"@module-federation/runtime": patch
"@module-federation/runtime-core": patch
"@module-federation/inject-external-runtime-core-plugin": patch
"@module-federation/runtime-tools": patch
"@module-federation/sdk": patch
"@module-federation/utilities": patch
"@module-federation/webpack-bundler-runtime": patch
---

use TSC instead of SWC
16 changes: 5 additions & 11 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: pnpm install

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

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

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

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

e2e-modern:
needs: checkout-install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: nrwl/nx-set-shas@v3

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

- name: Install Cypress
run: npx cypress install
Expand Down
4 changes: 3 additions & 1 deletion apps/3002-checkout/components/ButtonOldAnt.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Button from 'antd/lib/button';
import { version } from 'antd/package.json';
import antdPackage from 'antd/package.json';
import stuff from './stuff.module.css';

const { version } = antdPackage;
export default function ButtonOldAnt() {
return <Button className={stuff.test}>Button from antd@{version}</Button>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Button from 'antd/lib/button';
import { version } from 'antd/package.json';
import antdPackage from 'antd/package.json';
import * as stuff from './stuff.module.css';

const { version } = antdPackage;

export default function ButtonOldAnt() {
return (
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Button from 'antd/lib/button';
import { version } from 'antd/package.json';
import antdPackage from 'antd/package.json';
import stuff from './stuff.module.css';

const { version } = antdPackage;

export default function ButtonOldAnt() {
return <Button className={stuff.test}>Button from antd@{version}</Button>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Button from 'antd/lib/button';
import { version } from 'antd/package.json';
import antdPackage from 'antd/package.json';
import stuff from './stuff.module.css';

const { version } = antdPackage;

export default function ButtonOldAnt() {
return <Button className={stuff.test}>Button from antd@{version}</Button>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Button from 'antd/lib/button';
import { version } from 'antd/package.json';
import antdPackage from 'antd/package.json';
import stuff from './stuff.module.css';

const { version } = antdPackage;

export default function ButtonOldAnt() {
return (
<Button className={stuff['test-remote2'] + ' test-remote2'}>
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"assets": [],
"project": "packages/cli/package.json",
"rollupConfig": "packages/cli/rollup.config.js",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/data-prefetch/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"assets": [],
"project": "packages/data-prefetch/package.json",
"rollupConfig": "packages/data-prefetch/rollup.config.cjs",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/error-codes/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"rollupConfig": "packages/error-codes/rollup.config.js",
"assets": [],
"project": "packages/error-codes/package.json",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
10 changes: 10 additions & 0 deletions packages/error-codes/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
module.exports = (rollupConfig, projectOptions) => {
const adjustSourceMapPath = (relativePath) => {
const normalized = relativePath.replace(/\\/g, '/');
if (normalized.startsWith('../../src/')) {
return normalized.replace('../../src/', '../src/');
}
return normalized;
};

if (Array.isArray(rollupConfig.output)) {
rollupConfig.output = rollupConfig.output.map((c) => ({
...c,
sourcemap: true,
sourcemapPathTransform: adjustSourceMapPath,
hoistTransitiveImports: false,
entryFileNames:
c.format === 'esm'
Expand All @@ -18,6 +27,7 @@ module.exports = (rollupConfig, projectOptions) => {
rollupConfig.output = {
...rollupConfig.output,
sourcemap: true,
sourcemapPathTransform: adjustSourceMapPath,
hoistTransitiveImports: false,
entryFileNames:
rollupConfig.output.format === 'esm'
Expand Down
2 changes: 1 addition & 1 deletion packages/managers/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"external": ["@module-federation/*"],
"project": "packages/managers/package.json",
"rollupConfig": "packages/managers/rollup.config.js",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/manifest/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"external": ["@module-federation/*"],
"project": "packages/manifest/package.json",
"rollupConfig": "packages/manifest/rollup.config.js",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/rsbuild-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"external": ["@module-federation/*"],
"project": "packages/rsbuild-plugin/package.json",
"rollupConfig": "packages/rsbuild-plugin/rollup.config.js",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"external": ["@module-federation/*", "@rspack/core"],
"project": "packages/rspack/package.json",
"rollupConfig": "packages/rspack/rollup.config.js",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"assets": [],
"external": ["@module-federation/*"],
"project": "packages/runtime-core/package.json",
"compiler": "swc",
"compiler": "tsc",
"rollupConfig": "packages/runtime-core/rollup.config.cjs",
"format": ["cjs", "esm"],
"generatePackageJson": false,
Expand Down
10 changes: 10 additions & 0 deletions packages/runtime-core/rollup.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
const replace = require('@rollup/plugin-replace');
const copy = require('rollup-plugin-copy');

const adjustSourceMapPath = (relativePath) => {
const normalized = relativePath.replace(/\\/g, '/');
if (normalized.startsWith('../../src/')) {
return normalized.replace('../../src/', '../src/');
}
return normalized;
};

const FEDERATION_DEBUG = process.env.FEDERATION_DEBUG || '';

module.exports = (rollupConfig, projectOptions) => {
Expand Down Expand Up @@ -29,6 +37,7 @@ module.exports = (rollupConfig, projectOptions) => {
}
},
hoistTransitiveImports: false,
sourcemapPathTransform: adjustSourceMapPath,
entryFileNames:
c.format === 'cjs'
? c.entryFileNames.replace('.js', '.cjs')
Expand All @@ -49,6 +58,7 @@ module.exports = (rollupConfig, projectOptions) => {
}
},
hoistTransitiveImports: false,
sourcemapPathTransform: adjustSourceMapPath,
entryFileNames:
rollupConfig.output.format === 'cjs'
? rollupConfig.output.entryFileNames.replace('.js', '.cjs')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"assets": [],
"project": "packages/runtime-plugins/inject-external-runtime-core-plugin/package.json",
"rollupConfig": "packages/runtime-plugins/inject-external-runtime-core-plugin/rollup.config.cjs",
"compiler": "swc",
"compiler": "tsc",
"generatePackageJson": false,
"format": ["cjs", "esm"],
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-tools/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"tsConfig": "packages/runtime-tools/tsconfig.lib.json",
"assets": [],
"project": "packages/runtime-tools/package.json",
"compiler": "swc",
"compiler": "tsc",
"rollupConfig": "packages/runtime-tools/rollup.config.cjs",
"format": ["cjs", "esm"],
"external": ["@module-federation/*"],
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"assets": [],
"external": ["@module-federation/*"],
"project": "packages/runtime/package.json",
"compiler": "swc",
"compiler": "tsc",
"rollupConfig": "packages/runtime/rollup.config.cjs",
"format": ["cjs", "esm"],
"generatePackageJson": false,
Expand Down
10 changes: 10 additions & 0 deletions packages/runtime/rollup.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ const copy = require('rollup-plugin-copy');

const FEDERATION_DEBUG = process.env.FEDERATION_DEBUG || '';

const adjustSourceMapPath = (relativePath) => {
const normalized = relativePath.replace(/\\/g, '/');
if (normalized.startsWith('../../src/')) {
return normalized.replace('../../src/', '../src/');
}
return normalized;
};

module.exports = (rollupConfig, projectOptions) => {
rollupConfig.treeshake = { preset: 'recommended' };

Expand Down Expand Up @@ -33,6 +41,7 @@ module.exports = (rollupConfig, projectOptions) => {
}
},
hoistTransitiveImports: false,
sourcemapPathTransform: adjustSourceMapPath,
entryFileNames:
c.format === 'cjs'
? c.entryFileNames.replace(/\.js$/, '.cjs')
Expand All @@ -53,6 +62,7 @@ module.exports = (rollupConfig, projectOptions) => {
}
},
hoistTransitiveImports: false,
sourcemapPathTransform: adjustSourceMapPath,
entryFileNames:
rollupConfig.output.format === 'cjs'
? rollupConfig.output.entryFileNames.replace(/\.js$/, '.cjs')
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"project": "packages/sdk/package.json",
"additionalEntryPoints": ["packages/sdk/src/normalize-webpack-path.ts"],
"rollupConfig": "packages/sdk/rollup.config.cjs",
"compiler": "swc",
"compiler": "tsc",
"generatePackageJson": false,
"format": ["cjs", "esm"],
"useLegacyTypescriptPlugin": false
Expand Down
10 changes: 10 additions & 0 deletions packages/sdk/rollup.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
const copy = require('rollup-plugin-copy');

module.exports = (rollupConfig, _projectOptions) => {
const adjustSourceMapPath = (relativePath) => {
const normalized = relativePath.replace(/\\/g, '/');
if (normalized.startsWith('../../src/')) {
return normalized.replace('../../src/', '../src/');
}
return normalized;
};

rollupConfig.plugins.push(
copy({
targets: [{ src: 'packages/sdk/LICENSE', dest: 'packages/sdk/dist' }],
Expand All @@ -20,6 +28,7 @@ module.exports = (rollupConfig, _projectOptions) => {
},
hoistTransitiveImports: false,
minifyInternalExports: true,
sourcemapPathTransform: adjustSourceMapPath,
entryFileNames:
c.format === 'cjs'
? c.entryFileNames.replace('.js', '.cjs')
Expand All @@ -41,6 +50,7 @@ module.exports = (rollupConfig, _projectOptions) => {
},
hoistTransitiveImports: false,
minifyInternalExports: true,
sourcemapPathTransform: adjustSourceMapPath,
entryFileNames:
rollupConfig.output.format === 'cjs'
? rollupConfig.output.entryFileNames.replace('.js', '.cjs')
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"project": "packages/utilities/package.json",
"additionalEntryPoints": ["packages/utilities/src/types/types.ts"],
"external": ["@module-federation/*"],
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"generatePackageJson": false,
"useLegacyTypescriptPlugin": false
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-bundler-runtime/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"tsConfig": "packages/webpack-bundler-runtime/tsconfig.lib.json",
"assets": [],
"project": "packages/webpack-bundler-runtime/package.json",
"compiler": "swc",
"compiler": "tsc",
"format": ["cjs", "esm"],
"additionalEntryPoints": [
"packages/webpack-bundler-runtime/src/constant.ts"
Expand Down
10 changes: 10 additions & 0 deletions packages/webpack-bundler-runtime/rollup.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ const copy = require('rollup-plugin-copy');
module.exports = (rollupConfig, projectOptions) => {
rollupConfig.treeshake = { preset: 'recommended' };

const adjustSourceMapPath = (relativePath) => {
const normalized = relativePath.replace(/\\/g, '/');
if (normalized.startsWith('../../src/')) {
return normalized.replace('../../src/', '../src/');
}
return normalized;
};

rollupConfig.external = [
/@module-federation\/runtime/,
/@module-federation\/sdk/,
Expand All @@ -12,6 +20,7 @@ module.exports = (rollupConfig, projectOptions) => {
rollupConfig.output = rollupConfig.output.map((c) => ({
...c,
sourcemap: true,
sourcemapPathTransform: adjustSourceMapPath,
hoistTransitiveImports: false,
entryFileNames:
c.format === 'cjs'
Expand All @@ -27,6 +36,7 @@ module.exports = (rollupConfig, projectOptions) => {
rollupConfig.output = {
...rollupConfig.output,
sourcemap: true,
sourcemapPathTransform: adjustSourceMapPath,
hoistTransitiveImports: false,
entryFileNames:
rollupConfig.output.format === 'cjs'
Expand Down