This commit is contained in:
2026-04-21 18:03:08 +04:00
parent c72aef9fb0
commit bfc1781706
15 changed files with 116 additions and 2 deletions

View File

@@ -48,7 +48,8 @@
"maximumError": "8kB" "maximumError": "8kB"
} }
], ],
"outputHashing": "all" "outputHashing": "all",
"serviceWorker": "ngsw-config.json"
}, },
"development": { "development": {
"optimization": false, "optimization": false,

28
ngsw-config.json Normal file
View File

@@ -0,0 +1,28 @@
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.csr.html",
"/index.html",
"/manifest.webmanifest",
"/*.css",
"/*.js"
]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": ["/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"]
}
}
]
}

20
package-lock.json generated
View File

@@ -15,6 +15,7 @@
"@angular/platform-browser": "^22.0.0-next.0", "@angular/platform-browser": "^22.0.0-next.0",
"@angular/platform-server": "^22.0.0-next.0", "@angular/platform-server": "^22.0.0-next.0",
"@angular/router": "^22.0.0-next.0", "@angular/router": "^22.0.0-next.0",
"@angular/service-worker": "^22.0.0-next.0",
"@angular/ssr": "^22.0.0-next.5", "@angular/ssr": "^22.0.0-next.5",
"express": "^5.1.0", "express": "^5.1.0",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",
@@ -646,6 +647,25 @@
"rxjs": "^6.5.3 || ^7.4.0" "rxjs": "^6.5.3 || ^7.4.0"
} }
}, },
"node_modules/@angular/service-worker": {
"version": "22.0.0-next.8",
"resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-22.0.0-next.8.tgz",
"integrity": "sha512-dqQkRBX3WFNg8wJ+5NTbXUST2k7r4kMk9X0uCxaN86ptxvvn61LIF9rBwr7FKJLeDIq47jnWzwiX3UrN766YSw==",
"license": "MIT",
"dependencies": {
"tslib": "^2.3.0"
},
"bin": {
"ngsw-config": "ngsw-config.js"
},
"engines": {
"node": "^22.22.0 || >=24.13.1"
},
"peerDependencies": {
"@angular/core": "22.0.0-next.8",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@angular/ssr": { "node_modules/@angular/ssr": {
"version": "22.0.0-next.5", "version": "22.0.0-next.5",
"resolved": "https://registry.npmjs.org/@angular/ssr/-/ssr-22.0.0-next.5.tgz", "resolved": "https://registry.npmjs.org/@angular/ssr/-/ssr-22.0.0-next.5.tgz",

View File

@@ -19,6 +19,7 @@
"@angular/platform-browser": "^22.0.0-next.0", "@angular/platform-browser": "^22.0.0-next.0",
"@angular/platform-server": "^22.0.0-next.0", "@angular/platform-server": "^22.0.0-next.0",
"@angular/router": "^22.0.0-next.0", "@angular/router": "^22.0.0-next.0",
"@angular/service-worker": "^22.0.0-next.0",
"@angular/ssr": "^22.0.0-next.5", "@angular/ssr": "^22.0.0-next.5",
"express": "^5.1.0", "express": "^5.1.0",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/icons/icon-72x72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
public/icons/icon-96x96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,57 @@
{
"name": "angular-22-ssr-pwa",
"short_name": "angular-22-ssr-pwa",
"display": "standalone",
"scope": "./",
"start_url": "./",
"icons": [
{
"src": "icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable any"
}
]
}

View File

@@ -1,13 +1,18 @@
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core'; import { ApplicationConfig, provideBrowserGlobalErrorListeners, isDevMode } from '@angular/core';
import { provideRouter } from '@angular/router'; import { provideRouter } from '@angular/router';
import { routes } from './app.routes'; import { routes } from './app.routes';
import { provideClientHydration, withEventReplay } from '@angular/platform-browser'; import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
import { provideServiceWorker } from '@angular/service-worker';
export const appConfig: ApplicationConfig = { export const appConfig: ApplicationConfig = {
providers: [ providers: [
provideBrowserGlobalErrorListeners(), provideBrowserGlobalErrorListeners(),
provideRouter(routes), provideRouter(routes),
provideClientHydration(withEventReplay()), provideClientHydration(withEventReplay()),
provideServiceWorker('ngsw-worker.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000',
}),
], ],
}; };

View File

@@ -6,8 +6,10 @@
<base href="/" /> <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" /> <link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="manifest" href="manifest.webmanifest" />
</head> </head>
<body> <body>
<app-root></app-root> <app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body> </body>
</html> </html>