Skip to content

Commit

Permalink
feat: use rolldown minify
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 3, 2024
1 parent d437a93 commit a364a5f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
},
Expand All @@ -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 = {
Expand Down Expand Up @@ -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,
}
}
Expand Down

0 comments on commit a364a5f

Please sign in to comment.