mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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
This commit is contained in:
parent
4298bf199b
commit
5283c2b080
1 changed files with 18 additions and 1 deletions
|
|
@ -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:
|
||||
|
||||
<docs-code language="shell">
|
||||
|
||||
ng serve --prod
|
||||
|
||||
</docs-code>
|
||||
|
||||
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:
|
||||
|
||||
<docs-code language="shell">
|
||||
|
||||
npx http-server -p 8080 -c-1 dist/<project-name>/browser
|
||||
|
||||
</docs-code>
|
||||
|
||||
This will serve your application with service worker support at http://localhost:8080.
|
||||
|
||||
### Initial load
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue