Skip to content

Commit 9b5c037

Browse files
committed
fix(build): --minify not working as documented
closes #4523
1 parent 8b3e10c commit 9b5c037

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/node/build/bundle.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,7 @@ export async function bundle(
8888
ssr,
8989
ssrEmitAssets: config.mpa,
9090
// minify with esbuild in MPA mode (for CSS)
91-
minify: ssr
92-
? config.mpa
93-
? 'esbuild'
94-
: false
95-
: typeof options.minify === 'boolean'
96-
? options.minify
97-
: !process.env.DEBUG,
91+
minify: ssr ? !!config.mpa : (options.minify ?? !process.env.DEBUG),
9892
outDir: ssr ? config.tempDir : config.outDir,
9993
cssCodeSplit: false,
10094
rollupOptions: {

src/node/cli.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ if (process.env.DEBUG) {
1212

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

15+
Object.keys(argv).forEach((key) => {
16+
if (argv[key] === 'true') {
17+
argv[key] = true
18+
} else if (argv[key] === 'false') {
19+
argv[key] = false
20+
}
21+
})
22+
1523
const logVersion = (logger: Logger) => {
1624
logger.info(`\n ${c.green(`${c.bold('vitepress')} v${version}`)}\n`, {
1725
clear: !logger.hasWarned

0 commit comments

Comments
 (0)