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, } }