From a364a5f4cd1edc55b3a4db252b4d03a2cc5fb12b Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:40:48 +0900 Subject: [PATCH] feat: use rolldown minify --- packages/vite/src/node/build.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index d06c1657a43952..65e51a98f94b55 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -167,10 +167,10 @@ export interface BuildEnvironmentOptions { sourcemap?: boolean | 'inline' | 'hidden' /** * Set to `false` to disable minification, or specify the minifier to use. - * Available options are 'terser' or 'esbuild'. - * @default 'esbuild' + * Available options are 'terser' or 'esbuild' or 'oxc'. + * @default 'oxc' */ - minify?: boolean | 'terser' | 'esbuild' + minify?: boolean | 'terser' | 'esbuild' | 'oxc' /** * Options for terser * https://terser.org/docs/api-reference#minify-options @@ -418,7 +418,7 @@ export function resolveBuildEnvironmentOptions( { ...buildEnvironmentOptionsDefaults, cssCodeSplit: !raw.lib, - minify: consumer === 'server' ? false : 'esbuild', + minify: consumer === 'server' ? false : 'oxc', rollupOptions: { platform: consumer === 'server' ? 'node' : 'browser', }, @@ -438,7 +438,7 @@ export function resolveBuildEnvironmentOptions( if ((merged.minify as string) === 'false') { merged.minify = false } else if (merged.minify === true) { - merged.minify = 'esbuild' + merged.minify = 'oxc' } const defaultModulePreload = { @@ -777,6 +777,7 @@ async function buildEnvironment( : path.posix.join(options.assetsDir, `[name]-[hash].[ext]`), inlineDynamicImports: output.format === 'umd' || output.format === 'iife', + minify: options.minify === 'oxc' ? true : false, ...output, } }