@@ -38,7 +38,7 @@ export async function build() {
3838 await fse . emptyDir ( OUTPUT_PRANX_DIR ) ;
3939
4040 // Bundling
41- const optimize_output = true ;
41+ const optimize_output = false ;
4242
4343 const server_bundle_result = await bundle_server ( {
4444 optimize : optimize_output ,
@@ -53,6 +53,7 @@ export async function build() {
5353 // Manifests
5454 const server_site_manifest : SERVER_MANIFEST = {
5555 entry_server : join ( OUTPUT_BUNDLE_SERVER_DIR , "entry-server.js" ) ,
56+ global_css_filepath : "" ,
5657 routes : [ ] ,
5758 api : [ ] ,
5859 } ;
@@ -101,7 +102,7 @@ export async function build() {
101102 if ( ! file . endsWith ( ".css" ) ) continue ;
102103
103104 if ( file . endsWith ( "entry-client.css" ) ) {
104- css_output . entry = file . replace ( pranx_browser_base_path , "" ) ;
105+ css_output . entry = join ( OUTPUT_BUNDLE_BROWSER_DIR , file . replace ( pranx_browser_base_path , "" ) ) ;
105106 continue ;
106107 }
107108
@@ -116,6 +117,8 @@ export async function build() {
116117 css_output [ path_normalized ] = css_file_relative ;
117118 }
118119
120+ server_site_manifest . global_css_filepath = css_output . entry ;
121+
119122 // Generating Manifest and generating static pages data
120123 for ( const [ file , _output ] of Object . entries ( browser_bundle_result . metafile . outputs ) ) {
121124 if ( ! file . endsWith ( "page.js" ) ) continue ;
@@ -189,7 +192,7 @@ export async function build() {
189192 revalidate : statics_fn_result . revalidate || - 1 ,
190193 is_dynamic : isUrlDynamic ,
191194 dynamic_params : dynamic_params ,
192- css : [ css_output . entry , css_output [ final_path_normalized ] || "" ] . filter ( Boolean ) ,
195+ css : [ css_output [ final_path_normalized ] || "" ] . filter ( Boolean ) ,
193196 static_generated_routes : [ ] ,
194197 absolute_module_path : module_path ,
195198 } ) ;
@@ -247,12 +250,13 @@ export async function build() {
247250 static_generated_routes : [ ] ,
248251 is_dynamic : isUrlDynamic ,
249252 dynamic_params : dynamic_params ,
250- css : [ css_output . entry , css_output [ final_path_normalized ] || "" ] . filter ( Boolean ) as string [ ] ,
253+ css : [ css_output [ final_path_normalized ] || "" ] . filter ( Boolean ) as string [ ] ,
251254 absolute_module_path : module_path ,
252255 } ) ;
253256 }
254257
255258 const hydrate_data : HYDRATE_DATA = {
259+ entry_css : css_output . entry ,
256260 routes : server_site_manifest . routes . map ( ( r ) => {
257261 return {
258262 module : r . module ,
@@ -294,7 +298,8 @@ export async function build() {
294298 page_prerendered,
295299 hydrate_data_as_string,
296300 minify : optimize_output ,
297- css : route . css ,
301+ css_links : route . css ,
302+ critical_css_filepath : server_site_manifest . global_css_filepath ,
298303 } ) ;
299304
300305 const output_html_path = join ( OUTPUT_BUNDLE_BROWSER_DIR , static_route . path , "index.html" ) ;
@@ -314,7 +319,8 @@ export async function build() {
314319 page_prerendered,
315320 hydrate_data_as_string,
316321 minify : true ,
317- css : route . css ,
322+ css_links : route . css ,
323+ critical_css_filepath : server_site_manifest . global_css_filepath ,
318324 } ) ;
319325
320326 const output_html_path = join ( OUTPUT_BUNDLE_BROWSER_DIR , route . path , "index.html" ) ;
0 commit comments