Skip to content

Commit

Permalink
fix(build): --minify not working as documented
Browse files Browse the repository at this point in the history
closes #4523
  • Loading branch information
brc-dd committed Jan 26, 2025
1 parent 8b3e10c commit 9b5c037
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/node/build/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,7 @@ export async function bundle(
ssr,
ssrEmitAssets: config.mpa,
// minify with esbuild in MPA mode (for CSS)
minify: ssr
? config.mpa
? 'esbuild'
: false
: typeof options.minify === 'boolean'
? options.minify
: !process.env.DEBUG,
minify: ssr ? !!config.mpa : (options.minify ?? !process.env.DEBUG),
outDir: ssr ? config.tempDir : config.outDir,
cssCodeSplit: false,
rollupOptions: {
Expand Down
8 changes: 8 additions & 0 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ if (process.env.DEBUG) {

const argv: any = minimist(process.argv.slice(2))

Object.keys(argv).forEach((key) => {
if (argv[key] === 'true') {
argv[key] = true
} else if (argv[key] === 'false') {
argv[key] = false
}
})

const logVersion = (logger: Logger) => {
logger.info(`\n ${c.green(`${c.bold('vitepress')} v${version}`)}\n`, {
clear: !logger.hasWarned
Expand Down

0 comments on commit 9b5c037

Please sign in to comment.