Skip to content

ragingwind/sw-precache-webpack-plugin-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 / 2, 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

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

License

MIT © Jimmy Moon

About

Selectively load sw-precache-webpack plugin either it is working on webpack or webpack-dev-server

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published