Implement `offline-plugin` for Service Workers / App Cache (#701)

This commit is contained in:
William O'Beirne 2018-01-01 18:15:13 -05:00 committed by Daniel Ternyak
parent 8452e231d8
commit ef506c54d6
3 changed files with 8 additions and 10 deletions

View File

@ -5,13 +5,15 @@ import 'sass/styles.scss';
import 'babel-polyfill';
import 'whatwg-fetch';
import React from 'react';
import OfflineRuntime from 'offline-plugin/runtime';
import { render } from 'react-dom';
import Root from './Root';
import { configuredStore } from './store';
import consoleAdvertisement from './utils/consoleAdvertisement';
const appEl = document.getElementById('app');
OfflineRuntime.install();
const appEl = document.getElementById('app');
render(<Root store={configuredStore} />, appEl);
if (module.hot) {

View File

@ -93,6 +93,7 @@
"node-sass": "4.7.2",
"nodemon": "1.14.7",
"null-loader": "0.1.1",
"offline-plugin": "4.9.0",
"prettier": "1.9.2",
"progress": "2.0.0",
"react-hot-loader": "3.1.3",

View File

@ -6,7 +6,7 @@ const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
const BabelMinifyPlugin = require('babel-minify-webpack-plugin');
// const OfflinePlugin = require('offline-plugin')
const OfflinePlugin = require('offline-plugin');
const base = require('./webpack.base');
const config = require('./config');
const rimraf = require('rimraf');
@ -66,15 +66,10 @@ base.plugins.push(
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.[chunkhash:8].js'
}),
new OfflinePlugin({
appShell: '/'
})
// For progressive web apps
// new OfflinePlugin({
// relativePaths: false,
// AppCache: false,
// ServiceWorker: {
// events: true
// }
// })
);
// minimize webpack output