Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use rolldown minify #73

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: use rolldown minify
sapphi-red committed Dec 3, 2024

Verified

This commit was signed with the committer’s verified signature.
sapphi-red 翠 / green
commit a364a5f4cd1edc55b3a4db252b4d03a2cc5fb12b
11 changes: 6 additions & 5 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
@@ -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,
sapphi-red marked this conversation as resolved.
Show resolved Hide resolved
...output,
}
}