Skip to content

Commit e971292

Browse files
committed
fix(vite): precompress files during vite build
1 parent cca5e68 commit e971292

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/alepha/src/cli/commands/ViteCommands.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ export class ViteCommands {
178178
// No index.html
179179
}
180180

181+
// Extract client options
182+
const clientOptions =
183+
typeof viteAlephaBuildOptions.client === "object"
184+
? viteAlephaBuildOptions.client
185+
: {};
186+
181187
// Build client
182188
if (hasClient) {
183189
await run({
@@ -187,6 +193,7 @@ export class ViteCommands {
187193
silent: true,
188194
dist: `${distDir}/${clientDir}`,
189195
stats,
196+
precompress: clientOptions.precompress,
190197
}),
191198
});
192199
}
@@ -229,11 +236,7 @@ export class ViteCommands {
229236

230237
if (hasClient) {
231238
// Generate sitemap
232-
const sitemapBaseUrl =
233-
flags.sitemap ??
234-
(typeof viteAlephaBuildOptions.client === "object"
235-
? viteAlephaBuildOptions.client.sitemap?.hostname
236-
: undefined);
239+
const sitemapBaseUrl = flags.sitemap ?? clientOptions.sitemap?.hostname;
237240

238241
if (sitemapBaseUrl) {
239242
await run({
@@ -251,11 +254,7 @@ export class ViteCommands {
251254
}
252255

253256
// Pre-render static pages
254-
const shouldPrerender =
255-
flags.prerender ??
256-
(typeof viteAlephaBuildOptions.client === "object"
257-
? viteAlephaBuildOptions.client.prerender
258-
: false);
257+
const shouldPrerender = flags.prerender ?? clientOptions.prerender;
259258

260259
if (shouldPrerender) {
261260
await run({
@@ -264,6 +263,7 @@ export class ViteCommands {
264263
await prerenderPages({
265264
dist: `${distDir}/${clientDir}`,
266265
entry: `${distDir}/index.js`,
266+
compress: clientOptions.precompress,
267267
});
268268
},
269269
});

0 commit comments

Comments
 (0)