From 5283c2b080cfb156c011ee2b2edde9bca5d7b5e5 Mon Sep 17 00:00:00 2001 From: Vlad Boisa <60569670+vladboisa@users.noreply.github.com> Date: Sat, 15 Feb 2025 00:42:49 +0000 Subject: [PATCH] docs: add serve section to Service-worker (#59972) Add the section which mention way to enable service-worker during local development Fixes #59949 PR Close #59972 --- .../service-workers/getting-started.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/adev/src/content/ecosystem/service-workers/getting-started.md b/adev/src/content/ecosystem/service-workers/getting-started.md index bd839492867..ec89a81aae2 100644 --- a/adev/src/content/ecosystem/service-workers/getting-started.md +++ b/adev/src/content/ecosystem/service-workers/getting-started.md @@ -37,7 +37,24 @@ The CLI project is now set up to use the Angular service worker. ## Service worker in action: a tour This section demonstrates a service worker in action, -using an example application. +using an example application. To enable service worker support during local development, use the production configuration with the following command: + + + +ng serve --prod + + + +Alternatively, you can use the [`http-server package`](https://www.npmjs.com/package/http-server) from +npm, which supports service worker applications. Run it without installation using: + + + +npx http-server -p 8080 -c-1 dist/<project-name>/browser + + + +This will serve your application with service worker support at http://localhost:8080. ### Initial load