diff --git a/core/lib/Drupal/Core/Theme/ComponentPluginManager.php b/core/lib/Drupal/Core/Theme/ComponentPluginManager.php
index 9b33c7af2b93a6a4805f08203ddd421ac556044d..791b91ea93d21f3b6156f7983d4b29c09c952f51 100644
--- a/core/lib/Drupal/Core/Theme/ComponentPluginManager.php
+++ b/core/lib/Drupal/Core/Theme/ComponentPluginManager.php
@@ -469,6 +469,8 @@ private function makePathRelativeToLibraryRoot(string $path): string {
     $path_from_root = str_starts_with($path, $this->appRoot)
       ? substr($path, strlen($this->appRoot) + 1)
       : $path;
+    // Make sure this works seamlessly in every OS.
+    $path_from_root = str_replace(DIRECTORY_SEPARATOR, '/', $path_from_root);
     // The library owner is in <root>/core, so we need to go one level up to
     // find the app root.
     return '../' . $path_from_root;