Skip to content

Commit d01f914

Browse files
committed
fix: update and detect module type
1 parent 0a56962 commit d01f914

File tree

29 files changed

+579
-102
lines changed

29 files changed

+579
-102
lines changed

examples/module-federation/mf-host/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@module-federation/rsbuild-plugin": "^0.20.0",
1616
"@rsbuild/core": "1.6.0-beta.0",
1717
"@rsbuild/plugin-react": "^1.4.1",
18-
"@types/react": "^19.2.2",
19-
"@types/react-dom": "^19.2.1",
18+
"@types/react": "^19.2.0",
19+
"@types/react-dom": "^19.2.0",
2020
"typescript": "^5.9.3"
2121
}
2222
}

examples/module-federation/mf-remote/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@module-federation/rsbuild-plugin": "^0.20.0",
1616
"@rsbuild/core": "1.6.0-beta.0",
1717
"@rsbuild/plugin-react": "^1.4.1",
18-
"@types/react": "^19.2.2",
19-
"@types/react-dom": "^19.2.1",
18+
"@types/react": "^19.2.0",
19+
"@types/react-dom": "^19.2.0",
2020
"typescript": "^5.9.3"
2121
}
2222
}

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rslib/core",
3-
"version": "0.15.1",
3+
"version": "0.15.0",
44
"description": "The Rsbuild-based library development tool.",
55
"homepage": "https://rslib.rs",
66
"bugs": {
@@ -47,13 +47,13 @@
4747
"rsbuild-plugin-dts": "workspace:*"
4848
},
4949
"devDependencies": {
50-
"@module-federation/rsbuild-plugin": "^0.20.0",
50+
"@module-federation/rsbuild-plugin": "^0.19.1",
5151
"@rslib/tsconfig": "workspace:*",
5252
"@types/fs-extra": "^11.0.4",
5353
"cac": "^6.7.14",
5454
"chokidar": "^4.0.3",
5555
"fs-extra": "^11.3.2",
56-
"memfs": "^4.49.0",
56+
"memfs": "^4.48.1",
5757
"path-serializer": "0.5.1",
5858
"picocolors": "1.1.1",
5959
"prebundle": "1.4.2",

packages/core/src/config.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,30 @@ const composeExternalHelpersConfig = (
16911691
return defaultConfig;
16921692
};
16931693

1694+
const composeEsmDetectionConfig = (): EnvironmentConfig => {
1695+
const esm = { type: 'javascript/esm' };
1696+
const cjs = { type: 'javascript/dynamic' };
1697+
1698+
return {
1699+
tools: {
1700+
rspack: {
1701+
module: {
1702+
rules: [
1703+
{
1704+
test: /\.mts$/,
1705+
...esm,
1706+
},
1707+
{
1708+
test: /\.cts$/,
1709+
...cjs,
1710+
},
1711+
],
1712+
},
1713+
},
1714+
},
1715+
};
1716+
};
1717+
16941718
async function composeLibRsbuildConfig(
16951719
config: LibConfig,
16961720
multiCompilerIndex: number | null, // null means there's non multi-compiler
@@ -1720,6 +1744,8 @@ async function composeLibRsbuildConfig(
17201744
redirect = {},
17211745
umdName,
17221746
} = config;
1747+
const esmDetectionConfig = composeEsmDetectionConfig();
1748+
17231749
const { rsbuildConfig: bundleConfig } = composeBundleConfig(bundle);
17241750
const { rsbuildConfig: shimsConfig, enabledShims } = composeShimsConfig(
17251751
format,
@@ -1806,6 +1832,7 @@ async function composeLibRsbuildConfig(
18061832
const printFileSizeConfig = composePrintFileSizeConfig(bundle, target);
18071833

18081834
return mergeRsbuildConfig(
1835+
esmDetectionConfig,
18091836
bundleConfig,
18101837
formatConfig,
18111838
// outputConfig,

packages/plugin-dts/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rsbuild-plugin-dts",
3-
"version": "0.15.1",
3+
"version": "0.15.0",
44
"description": "Rsbuild plugin that supports emitting declaration files for TypeScript.",
55
"homepage": "https://rslib.rs",
66
"bugs": {
@@ -38,7 +38,7 @@
3838
"@microsoft/api-extractor": "^7.53.1",
3939
"@rsbuild/core": "1.6.0-beta.0",
4040
"@rslib/tsconfig": "workspace:*",
41-
"@typescript/native-preview": "7.0.0-dev.20251012.1",
41+
"@typescript/native-preview": "7.0.0-dev.20251005.1",
4242
"magic-string": "^0.30.19",
4343
"picocolors": "1.1.1",
4444
"prebundle": "1.4.2",

0 commit comments

Comments
 (0)