# @pwa/plugin-offline

> > [`PWA`](https://pwa.cafe/) plugin for [Offline Plugin](https://github.com/NekR/offline-plugin)

Latest version **0.5.0** (published 2020-03-31) · 0 weekly downloads

## Install

```sh
npm install @pwa/plugin-offline
pnpm add @pwa/plugin-offline
yarn add @pwa/plugin-offline
bun add @pwa/plugin-offline
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2020-03-31 |
| First published | 2018-09-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 1 |
| Unpacked size | 1.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lukeed, ragingwind |

## Links

- npm: https://www.npmjs.com/package/@pwa/plugin-offline
- npm.io page: https://npm.io/package/@pwa/plugin-offline

## Dependencies (1)

- [offline-plugin](https://npm.io/package/offline-plugin.md) ^5.0.5

## Recent versions

- 0.5.0 (latest) — 2020-03-31
- 0.4.1 — 2018-10-13
- 0.3.0 — 2018-09-11
- 0.2.0 — 2018-09-03

## README

# @pwa/plugin-offline

> [`PWA`](https://pwa.cafe/) plugin for [Offline Plugin](https://github.com/NekR/offline-plugin)

## Install

```sh
$ npm install --save-dev @pwa/plugin-offline
```

## Usage

The plugin is recognized by and attached to `@pwa/core` automatically.

However, you must manually include Offline's runtime into your bundle!

```js
if (process.env.NODE_ENV === 'production') {
  if ('serviceWorker' in navigator) {
    require('offline-plugin/runtime').install();
  }
}
```

> **Note:** For SW beginners, it's strongly recommended you use the above snippet!<br>
However, it's not required to wrap registration in a `NODE_ENV === 'production'` check.

## Config

Configurable via the `offline` key on your `pwa.config.js` file.

***Default Config:***

```js
exports.offline = {
  externals: [],
  appShell: '/index.html',
  excludes: ['**/.*', '**/*.map', '**/*.gz', '**/*.gzip', '**/*.br'],
  ServiceWorker: {
    output: 'sw.js',
    events: true
  }
}
```

***Available Options:***

Please refer to Offline Plugin's [options](https://github.com/NekR/offline-plugin/blob/HEAD/docs/options.md) options.

---
_Source: https://npm.io/package/@pwa/plugin-offline · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
