0

I need to mdify the ngsw-worker.js file in angular14, but I am wondering is it possible or not!? and how can I rename the ngsw-worker.js to like ngsw.js?

this file is located in my app node-module

Hesam Akbari
  • 1,071
  • 1
  • 5
  • 14

1 Answers1

0

You register the script for your service worker when importing the ServiceWorkerModule in your application module:

imports: [
  ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production }),
],

You could pass any other file name for your service worker there with your custom content.

See for more information the official Angular documentation on the ServiceWorkerModule here.

Wilt
  • 41,477
  • 12
  • 152
  • 203