stylesheets as $stylesheet ) { if ( empty( $stylesheet['href'] ) ) { continue; } $line = $this->process_reference( $stylesheet['href'], $source_dir, $theme_slug, $version, 'style', ++$index, $assets ); if ( '' !== $line ) { $lines[] = $line; } } foreach ( $doc->scripts as $script ) { if ( empty( $script['src'] ) ) { continue; // Inline scripts aren't enqueued in this phase. } if ( $this->is_pwa_registration_script( $script ) ) { continue; // See is_pwa_registration_script() docblock. } // Vite always marks its entry script type="module", but that // only breaks something if the bundle actually contains real // ES module import/export syntax — true for a heavily // code-split build (many chunks importing each other), false // for a single self-contained bundle with no cross-module // imports. wp_enqueue_script() doesn't preserve the original // type, so a code-split build silently failed at runtime // ("Cannot use import statement outside a module") until this // was tracked and restored via a script_loader_tag filter — // see Theme_Generator::render_module_script_filter(). $is_module = isset( $script['type'] ) && 'module' === $script['type']; $line = $this->process_reference( $script['src'], $source_dir, $theme_slug, $version, 'script', ++$index, $assets, $is_module ); if ( '' !== $line ) { $lines[] = $line; } } $assets->enqueue_php = implode( "\n", $lines ); $assets->body_html = $this->rewrite_body_html( $doc->body_html, $source_dir, $assets ); $this->rewrite_copied_css_files( $source_dir, $assets ); $this->discover_root_passthrough_files( $source_dir, $assets ); $this->rewrite_copied_js_files( $assets ); $this->discover_favicon( $doc, $source_dir, $assets ); $this->discover_theme_color_vars( $assets ); return $assets; } /** * Process a single /