UNPKG

@lynx-js/rspeedy

Version:

A webpack/rspack-based frontend toolchain for Lynx

86 lines (85 loc) 3.63 kB
export const __webpack_ids__ = [ "src_plugins_minify_plugin_ts" ]; export const __webpack_modules__ = { "./src/plugins/minify.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { pluginMinify: ()=>pluginMinify }); var _debug_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/debug.ts"); function pluginMinify(options) { const defaultConfig = Object.freeze({ output: { minify: { js: true, jsOptions: { minimizerOptions: { compress: { negate_iife: false, join_vars: false, ecma: 2015, inline: 2, comparisons: false, toplevel: true, side_effects: false }, format: { keep_quoted_props: true, comments: false }, mangle: { toplevel: true } } }, css: true, cssOptions: { minimizerOptions: { targets: '', include: { nesting: true, doublePositionGradients: true, spaceSeparatedColorNotation: true }, exclude: { vendorPrefixes: true, logicalProperties: true, hexAlphaColors: true } } } } } }); return { name: 'lynx:rsbuild:minify', setup (api) { api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{ if (false === options) { (0, _debug_js__WEBPACK_IMPORTED_MODULE_0__.fF)("minification disabled"); return mergeRsbuildConfig(config, { output: { minify: false } }); } const configs = [ config, defaultConfig ]; if (true !== options && void 0 !== options) { (0, _debug_js__WEBPACK_IMPORTED_MODULE_0__.fF)("merging minification options"); configs.push({ output: { minify: options } }); } return mergeRsbuildConfig(...configs); }); } }; } } };