## Install
`npm install offline-plugin [--save-dev]`
## Setup
First, instantiate the plugin in your `webpack.config`:
```js
// webpack.config.js example
var OfflinePlugin = require('offline-plugin');
module.exports = {
// ...
plugins: [
// ... other plugins
// it's always better if OfflinePlugin is the last plugin added
new OfflinePlugin()
]
// ...
}
```
_(and optionally configure with [options](docs/options.md))_
Then, add the [runtime](docs/runtime.md) into your entry file (typically main entry):
```js
require('offline-plugin/runtime').install();
```
ES6/Babel/TypeScript
```js
import * as OfflinePluginRuntime from 'offline-plugin/runtime';
OfflinePluginRuntime.install();
```
> For more details of usage with `TypeScript` see [here](docs/typescript.md)
### `offline-plugin` isn't working?
:information_source: **[Troubleshooting](docs/troubleshooting.md)** | **[FAQ](docs/FAQ.md)**
## Docs
* [Options](docs/options.md)
* [Caches](docs/caches.md)
* [Update process](docs/updates.md)
* [Cache Maps](docs/cache-maps.md)
* [Runtime API](docs/runtime.md)
## Examples
* [Single Page Application](docs/examples/SPA.md)
## Articles
* [Easy Offline First Apps With Webpack's Offline Plugin](https://dev.to/kayis/easy-offline-first-apps-with-webpacks-offline-plugin)
* [Handling Client Side App Updates (with Service Workers)](https://zach.codes/handling-client-side-app-updates-with-service-workers/)
## Options
All options are optional and `offline-plugin` can be used without specifying them.
#### [See all available options here.](docs/options.md)
## Who is using `offline-plugin`