-
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/build): handle external
@angular/
packages during SSR (#…
…29094) This commit introduces `ngServerMode` to ensure proper handling of external `@angular/` packages when they are used as externals during server-side rendering (SSR). Closes: #29092
- Loading branch information
1 parent
28bdbeb
commit d811a7f
Showing
3 changed files
with
69 additions
and
21 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
32 changes: 32 additions & 0 deletions
32
...2e/tests/build/server-rendering/server-routes-output-mode-server-external-dependencies.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,32 @@ | ||
import assert from 'node:assert'; | ||
import { ng } from '../../../utils/process'; | ||
import { installWorkspacePackages, uninstallPackage } from '../../../utils/packages'; | ||
import { updateJsonFile, useSha } from '../../../utils/project'; | ||
import { getGlobalVariable } from '../../../utils/env'; | ||
|
||
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', '--server-routing', '--skip-confirmation', '--skip-install'); | ||
await useSha(); | ||
await installWorkspacePackages(); | ||
|
||
await updateJsonFile('angular.json', (json) => { | ||
const build = json['projects']['test-project']['architect']['build']; | ||
build.options.externalDependencies = [ | ||
'@angular/platform-browser', | ||
'@angular/core', | ||
'@angular/router', | ||
'@angular/common', | ||
'@angular/common/http', | ||
'@angular/platform-browser/animations', | ||
]; | ||
}); | ||
|
||
await ng('build'); | ||
} |