Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ragingwind/sw-precache-webpack-plugin-loader
Selectively load sw-precache-webpack plugin either it is working on webpack or webpack-dev-server
https://github.com/ragingwind/sw-precache-webpack-plugin-loader
progressive-web-apps pwa sw-precache webpack
Last synced: about 2 months ago
JSON representation
Selectively load sw-precache-webpack plugin either it is working on webpack or webpack-dev-server
- Host: GitHub
- URL: https://github.com/ragingwind/sw-precache-webpack-plugin-loader
- Owner: ragingwind
- License: mit
- Created: 2017-04-14T08:35:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-18T06:44:20.000Z (over 7 years ago)
- Last Synced: 2024-11-09T01:41:56.668Z (2 months ago)
- Topics: progressive-web-apps, pwa, sw-precache, webpack
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# sw-precache-webpack-plugin-loader
> It just another handy module to load sw-precache-webpack plugin selectively either it is working on webpack or webpack-dev-server. Please read issues [1](https://github.com/goldhand/sw-precache-webpack-plugin#webpack-dev-server-support) / [2](https://github.com/ragingwind/sw-precache-webpack-dev-server-plugin#how-it-works), if you have a question why there are two of modules for sw-precache.## Install
```
$ yarn add sw-precache-webpack-plugin-loader --dev
```
or
```
$ npm install --save sw-precache-webpack-plugin-loader
```## Usage
```js
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin-loader');
const packageJSON = require('./package.json');{
...
plugins: [
...
new SWPrecacheWebpackPlugin({
// configs of sw-precache
cacheId: `${packageJSON.name}-${packageJSON.version}`,
staticFileGlobs: [
path.join(webpackOutput.path, '**/*')
],
runtimeCaching: [{
urlPattern: /https:\/\/.+.firebaseio.com/,
handler: 'networkFirst'
}],
logger: function () {},
filename: 'sw.js',
// configs of sw-precache-webpack-plugin
minify: process.env.NODE_ENV ? 'production' : 'development'
})
]
};
```## Relevant Projects
- [ragingwind/sw-precache-webpack-dev-server-plugin: Webpack Plugin for using sw-precache during development with webpack-dev-server](https://goo.gl/FyXM10)
- [goldhand/sw-precache-webpack-plugin: Webpack plugin that generates a service worker using sw-precache that will cache webpack's bundles' emitted assets. You can optionally pass sw-precache configuration options to webpack through this plugin.](https://goo.gl/9ueQty)## License
MIT © [Jimmy Moon](http://ragingwind.me)