@gravity-ui/app-builder 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@ import type { EditorFeature } from 'monaco-editor-webpack-plugin/out/features';
|
|
|
3
3
|
import type { IFeatureDefinition } from 'monaco-editor-webpack-plugin/out/types';
|
|
4
4
|
import type { Options as MomentTzOptions } from 'moment-timezone-data-webpack-plugin';
|
|
5
5
|
import type { Configuration, DefinePlugin, FileCacheOptions, MemoryCacheOptions } from 'webpack';
|
|
6
|
-
import type { Configuration as RspackConfiguration } from '@rspack/core';
|
|
6
|
+
import type { Configuration as RspackConfiguration, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
|
|
7
7
|
import type * as Babel from '@babel/core';
|
|
8
8
|
import type * as Swc from '@swc/core';
|
|
9
9
|
import type { ServerConfiguration } from 'webpack-dev-server';
|
|
@@ -214,6 +214,11 @@ export interface ClientConfig {
|
|
|
214
214
|
* Modify or return a custom [Terser options](https://github.com/terser/terser#minify-options).
|
|
215
215
|
*/
|
|
216
216
|
terser?: (options: TerserOptions) => TerserOptions;
|
|
217
|
+
/**
|
|
218
|
+
* Modify or return a custom [SWC minification options](https://swc.rs/docs/configuration/minification).
|
|
219
|
+
* Available with rspack bundler.
|
|
220
|
+
*/
|
|
221
|
+
swcMinimizerOptions?: (options: SwcJsMinimizerRspackPluginOptions) => SwcJsMinimizerRspackPluginOptions;
|
|
217
222
|
ssr?: {
|
|
218
223
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
219
224
|
moduleType?: 'commonjs' | 'esm';
|
|
@@ -1109,23 +1109,25 @@ function configureRspackOptimization(helperOptions) {
|
|
|
1109
1109
|
},
|
|
1110
1110
|
});
|
|
1111
1111
|
}
|
|
1112
|
+
let swcMinifyOptions = {
|
|
1113
|
+
minimizerOptions: {
|
|
1114
|
+
mangle: !config.reactProfiling,
|
|
1115
|
+
compress: {
|
|
1116
|
+
passes: 2,
|
|
1117
|
+
},
|
|
1118
|
+
format: {
|
|
1119
|
+
safari10: config.safari10,
|
|
1120
|
+
},
|
|
1121
|
+
},
|
|
1122
|
+
};
|
|
1123
|
+
const { swcMinimizerOptions } = config;
|
|
1124
|
+
if (typeof swcMinimizerOptions === 'function') {
|
|
1125
|
+
swcMinifyOptions = swcMinimizerOptions(swcMinifyOptions);
|
|
1126
|
+
}
|
|
1112
1127
|
const optimization = {
|
|
1113
1128
|
splitChunks: getOptimizationSplitChunks(helperOptions),
|
|
1114
1129
|
runtimeChunk: 'single',
|
|
1115
|
-
minimizer: [
|
|
1116
|
-
new core_1.rspack.SwcJsMinimizerRspackPlugin({
|
|
1117
|
-
minimizerOptions: {
|
|
1118
|
-
mangle: !config.reactProfiling,
|
|
1119
|
-
compress: {
|
|
1120
|
-
passes: 2,
|
|
1121
|
-
},
|
|
1122
|
-
format: {
|
|
1123
|
-
safari10: config.safari10,
|
|
1124
|
-
},
|
|
1125
|
-
},
|
|
1126
|
-
}),
|
|
1127
|
-
cssMinimizer,
|
|
1128
|
-
],
|
|
1130
|
+
minimizer: [new core_1.rspack.SwcJsMinimizerRspackPlugin(swcMinifyOptions), cssMinimizer],
|
|
1129
1131
|
};
|
|
1130
1132
|
return optimization;
|
|
1131
1133
|
}
|