Angular 6 - "Service workers are disabled or not supported" error

Just set the service worker to work in dev environment also in 'AppModule'

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

To

ServiceWorkerModule.register('ngsw-worker.js', { enabled: true})

This error was caused due to the reason that service workers don't work with ng serve. Run with http-server then it works fine. As in Angular service workers said:

Because ng serve does not work with service workers, you must use a separate HTTP server to test your project locally. You can use any HTTP server