Skip to content

Commit 67485de

Browse files
Brooooooklynclaude
andcommitted
fix: normalize relative path for Windows compatibility in SSR manifest
Use Vite's `normalizePath()` on the `relative()` output to convert backslash-separated Windows paths to forward slashes before interpolating into the `import()` expression. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 21f6ca4 commit 67485de

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

napi/angular-compiler/vite-plugin/angular-ssr-manifest-plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { readFile } from 'node:fs/promises'
1717
import { dirname, relative, resolve } from 'node:path'
1818

1919
import type { Plugin, ResolvedConfig } from 'vite'
20+
import { normalizePath } from 'vite'
2021

2122
/**
2223
* Unsafe characters that need escaping in template literals.
@@ -165,7 +166,7 @@ export function ssrManifestPlugin(options: SsrManifestPluginOptions): Plugin {
165166

166167
// Compute the import path for main.server.ts relative to the current file
167168
const fileDir = dirname(id)
168-
let ssrEntryImport = relative(fileDir, ssrEntryPath).replace(/\.ts$/, '')
169+
let ssrEntryImport = normalizePath(relative(fileDir, ssrEntryPath)).replace(/\.ts$/, '')
169170
if (!ssrEntryImport.startsWith('.')) {
170171
ssrEntryImport = './' + ssrEntryImport
171172
}

0 commit comments

Comments
 (0)