-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular/ssr): correctly resolve pre-transform resources in Vite …
…SSR without AppEngine Ensure proper resolution of pre-transform resources when using SSR in Vite without relying on AppEngine. Closes #29132
- Loading branch information
1 parent
78c41f6
commit 1bf9381
Showing
2 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/legacy-cli/e2e/tests/vite/ssr-no-server-entry-sub-path.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import assert from 'node:assert'; | ||
import { | ||
execAndWaitForOutputToMatch, | ||
ng, | ||
silentNg, | ||
waitForAnyProcessOutputToMatch, | ||
} from '../../utils/process'; | ||
import { installWorkspacePackages, uninstallPackage } from '../../utils/packages'; | ||
import { useSha } from '../../utils/project'; | ||
import { getGlobalVariable } from '../../utils/env'; | ||
import { findFreePort } from '../../utils/network'; | ||
import { writeFile } from '../../utils/fs'; | ||
|
||
export default async function () { | ||
assert( | ||
getGlobalVariable('argv')['esbuild'], | ||
'This test should not be called in the Webpack suite.', | ||
); | ||
|
||
// Forcibly remove in case another test doesn't clean itself up. | ||
await uninstallPackage('@angular/ssr'); | ||
await ng('add', '@angular/ssr', '--no-server-routing', '--skip-confirmation', '--skip-install'); | ||
await useSha(); | ||
await installWorkspacePackages(); | ||
|
||
await silentNg('generate', 'component', 'home'); | ||
await writeFile( | ||
'src/app/app.routes.ts', | ||
` | ||
import { Routes } from '@angular/router'; | ||
import {HomeComponent} from './home/home.component'; | ||
export const routes: Routes = [{ | ||
path: 'sub/home', | ||
component: HomeComponent | ||
}]; | ||
`, | ||
); | ||
|
||
const port = await findFreePort(); | ||
await execAndWaitForOutputToMatch('ng', ['serve', '--port', `${port}`], /complete/, { | ||
NO_COLOR: 'true', | ||
}); | ||
|
||
const [, response] = await Promise.all([ | ||
assert.rejects( | ||
waitForAnyProcessOutputToMatch(/Pre-transform error: Failed to load url/, 8_000), | ||
), | ||
fetch(`http://localhost:${port}/sub/home`), | ||
]); | ||
|
||
assert(response.ok, `Expected 'response.ok' to be 'true'.`); | ||
} |