Skip to content

Commit 8e41ba5

Browse files
authored
fix: temporarily use Terser for minifying Rspack projects (#1237)
1 parent 55ec91b commit 8e41ba5

4 files changed

Lines changed: 36 additions & 22 deletions

File tree

.changeset/tall-towns-pay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@callstack/repack": patch
3+
---
4+
5+
Use preconfigured Terser as minimizer for Rspack configurations

packages/repack/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"schema-utils": "^4.2.0",
9797
"shallowequal": "^1.1.0",
9898
"tapable": "^2.2.1",
99+
"terser-webpack-plugin": "^5.3.14",
99100
"throttleit": "^2.1.0",
100101
"webpack-merge": "^6.0.1"
101102
},

packages/repack/src/commands/common/config/getRepackConfig.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import TerserPlugin from 'terser-webpack-plugin';
2+
13
export function getRepackConfig() {
24
return {
35
devtool: 'source-map',
@@ -11,6 +13,20 @@ export function getRepackConfig() {
1113
},
1214
optimization: {
1315
chunkIds: 'named',
16+
minimizer: [
17+
// TODO: remove this default in favour explicit configuration in webpack
18+
// and implicit configuration in rspack using SwcJsMinimizerRspackPlugin
19+
// once https://github.com/web-infra-dev/rspack/issues/11183 is resolved
20+
new TerserPlugin({
21+
test: /\.(js)?bundle(\?.*)?$/i,
22+
extractComments: false,
23+
terserOptions: {
24+
format: {
25+
comments: false,
26+
},
27+
},
28+
}),
29+
],
1430
},
1531
};
1632
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)