mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-21 18:47:50 +02:00
feat(core): faster JS minimizer - siteConfig.future.experimental_faster.swcJsMinimizer
(#10441)
This commit is contained in:
parent
aa65f39d8c
commit
bb90e35153
19 changed files with 202 additions and 36 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import type {RuleSetRule} from 'webpack';
|
||||
import type {JsMinifyOptions} from '@swc/core';
|
||||
|
||||
export function getSwcJsLoaderFactory({
|
||||
isServer,
|
||||
|
@ -33,3 +34,24 @@ export function getSwcJsLoaderFactory({
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Note: these options are similar to what we use in core
|
||||
// They should rather be kept in sync for now to avoid any unexpected behavior
|
||||
// The goal of faster minifier is not to fine-tune options but only to be faster
|
||||
// See core minification.ts
|
||||
export function getSwcJsMinifierOptions(): JsMinifyOptions {
|
||||
return {
|
||||
ecma: 2020,
|
||||
compress: {
|
||||
ecma: 5,
|
||||
},
|
||||
module: true,
|
||||
mangle: true,
|
||||
safari10: true,
|
||||
format: {
|
||||
ecma: 5,
|
||||
comments: false,
|
||||
ascii_only: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue