offline-plugin

by NekR

Offline plugin (ServiceWorker, AppCache) for webpack (https://webpack.js.org/)

4.4K Stars 288 Forks Last release: over 1 year ago (v5.0.7) MIT License 700 Commits 23 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

offline-plugin logo

offline-plugin for webpack

backers sponsors npm npm


This plugin is intended to provide an offline experience for webpack projects. It uses ServiceWorker, and AppCache as a fallback under the hood. Simply include this plugin in your

webpack.config
, and the accompanying runtime in your client script, and your project will become offline ready by caching all (or some) of the webpack output assets.

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site.
Become a sponsor

Install

npm install offline-plugin [--save-dev]

Setup

First, instantiate the plugin in your

webpack.config
:
// 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)

Then, add the runtime into your entry file (typically main entry):

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

offline-plugin
isn't working?

:information_source: Troubleshooting | FAQ

Docs

Examples

Articles

Options

All options are optional and

offline-plugin
can be used without specifying them.

See all available options here.

Who is using
offline-plugin

Projects

PWAs

If you are using

offline-plugin
, feel free to submit a PR to add your project to this list.

Like
offline-plugin
?

Support it by giving feedback, contributing, becoming a backer/sponsor or just by ๐ŸŒŸ starring the project!

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Contribution

See CONTRIBUTING

License

MIT
Logo

CHANGELOG

CHANGELOG

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.