Skip to content

Commit a37c97f

Browse files
NataliaTepluhinahaoqunjiang
authored andcommitted
docs: added an explanation about why service worker is included only in production mode (#3050) [ci skip]
closes #2278
1 parent 9697caf commit a37c97f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/@vue/cli-plugin-pwa/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
> pwa plugin for vue-cli
44
5+
The service worker added with this plugin is only enabled in the production environment (e.g. only if you run `npm run build` or `yarn build`). Enabling service worker in a development mode is not a recommended practice, because it can lead to the situation when previously cached assets are used and the latest local changes are not included.
6+
7+
Instead, in the development mode the `noopServiceWorker.js` is included. This service worker file is effectively a 'no-op' that will reset any previous service worker registered for the same host:port combination.
8+
9+
If you need to test a service worker locally, build the application and run a simple HTTP-server from your build directory. It's recommended to use a browser incognito window to avoid complications with your browser cache.
10+
511
## Configuration
612

713
Configuration is handled via the `pwa` property of either the `vue.config.js`
@@ -54,7 +60,7 @@ file, or the `"vue"` field in `package.json`.
5460
- Default: `'default'`
5561

5662
- **pwa.assetsVersion**
57-
63+
5864
- Default: `''`
5965

6066
This option is used if you need to add a version to your icons and manifest, against browser’s cache. This will append `?v=<pwa.assetsVersion>` to the URLs of the icons and manifest.

0 commit comments

Comments
 (0)