From 6e18901e214934ade1c973f847746c0a169b0a00 Mon Sep 17 00:00:00 2001 From: Shyamsundar Gadde Date: Wed, 13 Nov 2024 23:41:07 +0530 Subject: [PATCH] Refactor conditional logic for script path assignment Co-authored-by: Weston Ruter --- plugins/web-worker-offloading/hooks.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/web-worker-offloading/hooks.php b/plugins/web-worker-offloading/hooks.php index 6778c61283..7e90a5eed4 100644 --- a/plugins/web-worker-offloading/hooks.php +++ b/plugins/web-worker-offloading/hooks.php @@ -21,9 +21,10 @@ function plwwo_register_default_scripts( WP_Scripts $scripts ): void { // The source code for partytown.js is built from . // See webpack config in the WordPress/performance repo: . - $partytown_js_path = '/build/partytown.js'; if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { $partytown_js_path = '/build/debug/partytown.js'; + } else { + $partytown_js_path = '/build/partytown.js'; } $partytown_js = file_get_contents( __DIR__ . $partytown_js_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- It's a local filesystem path not a remote request.