perf: optimize production assets and proxy-aware URLs
This commit is contained in:
@@ -158,10 +158,13 @@ export async function runBuild(appRoot: string): Promise<void> {
|
||||
config.styles,
|
||||
);
|
||||
assetHash.update(css);
|
||||
writeFileSync(join(distDir, "styles.css"), css, "utf8");
|
||||
const combinedCss = `${frameworkStyles}\n${css}`;
|
||||
// One blocking CSS request in production: tokens → UI → application CSS.
|
||||
// The standalone framework.css remains available for apps without global CSS.
|
||||
writeFileSync(join(distDir, "styles.css"), combinedCss, "utf8");
|
||||
hasStyles = true;
|
||||
if (Buffer.byteLength(css, "utf8") <= INLINE_CSS_LIMIT_BYTES) {
|
||||
inlineStyles = css;
|
||||
if (Buffer.byteLength(combinedCss, "utf8") <= INLINE_CSS_LIMIT_BYTES) {
|
||||
inlineStyles = combinedCss;
|
||||
}
|
||||
console.log(`✓ Styles: ${join(distDir, "styles.css")}`);
|
||||
}
|
||||
@@ -254,6 +257,7 @@ await createProductionServer(
|
||||
realtime: ${config.realtime ? JSON.stringify(config.realtime) : "undefined"},
|
||||
publicDir: join(import.meta.dir, "public"),
|
||||
${hasStyles ? `stylesPath: join(import.meta.dir, "styles.css"),` : ""}
|
||||
${hasStyles ? `stylesIncludeFramework: true,` : ""}
|
||||
${inlineStyles ? `inlineStyles: ${JSON.stringify(inlineStyles)},` : ""}
|
||||
assetVersion: ${JSON.stringify(assetVersion)},
|
||||
head: ${JSON.stringify(headStr)},
|
||||
|
||||
Reference in New Issue
Block a user