3.0.0 • Published 10 years ago

@easy-webpack/config-offline v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

@easy-webpack/config-offline

Enable offline capability of your webapp using ServiceWorker or AppCache.

This config use offline-plugin to achieve generation of ServiceWorker and AppCache files.

Installation

npm install --save-dev @easy-webpack/config-offline

easy-webpack is also required.

Usage

// webpack.config.js
const generateConfig = require('@easy-webpack/core').generateConfig;

const baseConfig = { ... }; // project-specific config like the entry file

const offlineConfig = {
  caches: {
    main: [':rest:'],
    additional: [':externals:'],
    optional: ['*.chunk.js']
  },
  ServiceWorker: {
    events: true
  },
  AppCache: {
    caches: ['main', 'additional', 'optional']
  }
}

module.exports = generateConfig(
  baseConfig,
  
  require('@easy-webpack/config-offline')
    ({ options: offlineConfig })
);

// Any client JS file, typically main entry
require('offline-plugin/runtime').install();

// This config will generate a service worker and app cache config in output path 

It is recommended to put config-offline at the end of webpack config chain.

Options

options

Type: Object Default: {}

This is identical to options in offline-plugin. Please check their documentation on how to configure it.

Related tutorials

3.0.0

10 years ago

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago