Skip to content

Commit

Permalink
use shared conservative swc minifier options
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 11, 2024
1 parent b913a17 commit b02fb3e
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions packages/docusaurus-bundler/src/minification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,14 @@ async function getRspackMinimizers({
}: MinimizersConfig): Promise<WebpackPluginInstance[]> {
const rspack = getCurrentBundlerAsRspack({currentBundler});
const browserslistQueries = await importBrowserslistQueries();
const swcJsMinimizerOptions = await importSwcJsMinimizerOptions();
return [
// See https://rspack.dev/plugins/rspack/swc-js-minimizer-rspack-plugin
// See https://swc.rs/docs/configuration/minification
new rspack.SwcJsMinimizerRspackPlugin({
minimizerOptions: {
minify: true,
compress: {
ecma: 6,
// to minimize function to arrow, like Terser did before
unsafe_arrows: true,
},
mangle: {
safari10: true,
},
format: {
ecma: 6,
// Turned on because emoji and regex is not minified properly using
// default. See https://github.com/facebook/create-react-app/issues/2488
ascii_only: true,
comments: false,
},
...swcJsMinimizerOptions,
},
}),
new rspack.LightningCssMinimizerRspackPlugin({
Expand Down

0 comments on commit b02fb3e

Please sign in to comment.