-
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-devkit/build-angular): rewire sourcemap back to original…
… source root Prior to this change, when a error occurs when using the SSR dev-server the stacktraces pointed back to the virtual root path. (cherry picked from commit 286e5d3)
- Loading branch information
1 parent
b36b7e5
commit 4c25164
Showing
2 changed files
with
48 additions
and
14 deletions.
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
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,38 @@ | ||
import { doesNotMatch, match } from 'node:assert'; | ||
import { killAllProcesses, ng } from '../../utils/process'; | ||
import { appendToFile, rimraf } from '../../utils/fs'; | ||
import { ngServe, useSha } from '../../utils/project'; | ||
import { installWorkspacePackages } from '../../utils/packages'; | ||
|
||
export default async function () { | ||
// Forcibly remove in case another test doesn't clean itself up. | ||
await rimraf('node_modules/@angular/ssr'); | ||
await ng('add', '@angular/ssr', '--skip-confirmation'); | ||
await useSha(); | ||
await installWorkspacePackages(); | ||
|
||
try { | ||
// Create Error. | ||
await appendToFile( | ||
'src/app/app.component.ts', | ||
` | ||
(() => { | ||
throw new Error('something happened!'); | ||
})(); | ||
`, | ||
); | ||
|
||
const port = await ngServe(); | ||
const response = await fetch(`http://localhost:${port}/`); | ||
const text = await response.text(); | ||
|
||
// The error is also sent in the browser, so we don't need to scrap the stderr. | ||
match( | ||
text, | ||
/something happened.+at eval \(.+\/e2e-test[\\\/]test-project[\\\/]src[\\\/]app[\\\/]app\.component\.ts:\d+:\d+\)/, | ||
); | ||
doesNotMatch(text, /vite-root/); | ||
} finally { | ||
await killAllProcesses(); | ||
} | ||
} |