Description
Command
build
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
Description
I am using Angular 18 with @angular/pwa
Inside ngsw-config.json
, inside the assets group, you can find the initial app
group.
By default, the content of the asset group is the following
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/manifest.webmanifest",
"/*.css",
"/*.js"
]
}
}
If you use Angular with SSR and prefetch false, you will not get the index.html
file in the dist folder. You will only get the index.csr.html
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/prototype",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": [],
"server": "src/main.server.ts",
"prerender": true,
"ssr": {
"entry": "server.ts"
}
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all",
"serviceWorker": "ngsw-config.json"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
This seems like a bug.
I observed that suddenly we always make a request for the index.html bypassing the advantage of having it cached by the SW.
https://angular.dev/guide/ssr#using-angular-service-worker
Minimal Reproduction
ng new prototype
ng add @angular/pwa
change the prerender to false
ng build
node dist/prototype/server/server.mjs
Exception or Error
No response
Your Environment
Angular CLI: 18.2.7
Node: 22.5.1
Package Manager: npm 10.8.2
OS: win32 x64
Angular: 18.2.7
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker, ssr
Package Version
@angular-devkit/architect 0.1802.7
@angular-devkit/build-angular 18.2.7
@angular-devkit/core 18.2.7
@angular-devkit/schematics 18.2.7
@schematics/angular 18.2.7
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10
Anything else relevant?
No response