Skip to content

Commit 3a68db0

Browse files
nyqykknyqykk
andauthored
fix: "mf" format output should be minified by default (#328)
Co-authored-by: nyqykk <[email protected]>
1 parent 607a934 commit 3a68db0

File tree

16 files changed

+259
-92
lines changed

16 files changed

+259
-92
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"react-dom": "^18.3.1"
1313
},
1414
"devDependencies": {
15-
"@module-federation/rsbuild-plugin": "^0.0.2",
15+
"@module-federation/rsbuild-plugin": "^0.6.13",
1616
"@rsbuild/core": "~1.0.17",
1717
"@rsbuild/plugin-react": "^1.0.5",
1818
"@types/react": "^18.3.11",

examples/module-federation/mf-react-component/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"serve": "pnpm build && http-server -p 3001 ./dist/ --cors"
1717
},
1818
"devDependencies": {
19-
"@module-federation/enhanced": "^0.6.11",
20-
"@module-federation/rsbuild-plugin": "^0.0.2",
19+
"@module-federation/enhanced": "^0.6.13",
20+
"@module-federation/rsbuild-plugin": "^0.6.13",
2121
"@rsbuild/plugin-react": "^1.0.5",
2222
"@rslib/core": "workspace:*",
2323
"@types/react": "^18.3.11",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"react-dom": "^18.3.1"
1313
},
1414
"devDependencies": {
15-
"@module-federation/rsbuild-plugin": "^0.0.2",
15+
"@module-federation/rsbuild-plugin": "^0.6.13",
1616
"@rsbuild/core": "~1.0.17",
1717
"@rsbuild/plugin-react": "^1.0.5",
1818
"@types/react": "^18.3.11",

packages/core/src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ export function composeMinifyConfig(config: LibConfig): RsbuildConfig {
304304
jsOptions: {
305305
minimizerOptions: {
306306
mangle: false,
307-
minify: false,
307+
// MF assets are loaded over the network, which means they will not be compressed by the project. Therefore, minifying them is necessary.
308+
minify: format === 'mf',
308309
compress: {
309310
defaults: false,
310311
unused: true,

pnpm-lock.yaml

Lines changed: 86 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/minify/config/rslib.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'node:path';
12
import { defineConfig } from '@rslib/core';
23
import { generateBundleEsmConfig } from 'test-helper';
34

@@ -9,7 +10,7 @@ export default defineConfig({
910
},
1011
source: {
1112
entry: {
12-
index: './src/index.ts',
13+
index: path.resolve(__dirname, '../__fixtures__/src/index.ts'),
1314
},
1415
},
1516
});

tests/integration/minify/default/rslib.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'node:path';
12
import { defineConfig } from '@rslib/core';
23
import { generateBundleEsmConfig } from 'test-helper';
34

@@ -8,7 +9,7 @@ export default defineConfig({
89
},
910
source: {
1011
entry: {
11-
index: './src/index.ts',
12+
index: path.resolve(__dirname, '../__fixtures__/src/index.ts'),
1213
},
1314
},
1415
});

0 commit comments

Comments
 (0)