Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"lodash": "^4.15.0",
"loop-breaker": "^0.1.0-alpha.7",
"moment": "^2.14.1",
"offline-plugin": "^4.8.1",
"pify": "^2.3.0",
"promise-retry": "^1.1.1",
"prop-types": "^15.5.10",
Expand Down
8 changes: 7 additions & 1 deletion src/application.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import './init';
import './util/Bugsnag';
import React from 'react';
import ReactDOM from 'react-dom';
import Immutable from 'immutable';
import installDevTools from 'immutable-devtools';
import {install as installOfflinePlugin} from 'offline-plugin/runtime';
import Bugsnag from './util/Bugsnag';
import Application from './components/Application';
import initI18n from './util/initI18n';
import {init as initAnalytics, logPageview} from './clients/googleAnalytics';

installDevTools(Immutable);
installOfflinePlugin({
onUpdateFailed() {
Bugsnag.notify('ServiceWorker update failed');
},
});

initI18n();
initAnalytics();
Expand Down
28 changes: 27 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

const fs = require('fs');
const path = require('path');
const OfflinePlugin = require('offline-plugin');
const webpack = require('webpack');
const escapeRegExp = require('lodash/escapeRegExp');
const startsWith = require('lodash/startsWith');
Expand Down Expand Up @@ -38,7 +39,6 @@ const babelrc = {
}),
};


function matchModule(modulePath) {
const modulePattern = new RegExp(
escapeRegExp(path.join('/node_modules', modulePath))
Expand Down Expand Up @@ -214,6 +214,32 @@ module.exports = {
WARN_ON_DROPPED_ERRORS: 'false',
GOOGLE_ANALYTICS_TRACKING_ID: 'UA-90316486-2'
}),
// it's always better if OfflinePlugin is the last plugin added https://github.com/NekR/offline-plugin#setup
new OfflinePlugin({
publicPath: '/',
responseStrategy: 'network-first',
externals: [
'index.html',
'application.css',
'fonts/Roboto-Regular-webfont.woff',
'fonts/Roboto-Regular-webfont.ttf',
'fonts/Roboto-Regular-webfont.eot',
'fonts/Roboto-Bold-webfont.woff',
'fonts/Roboto-Bold-webfont.ttf',
'fonts/Roboto-Bold-webfont.eot',
'fonts/inconsolata-regular.woff2',
'fonts/inconsolata-regular.woff',
'fonts/inconsolata-regular.ttf',
'fonts/inconsolata-regular.eot',
'fonts/fontawesome-webfont.woff2',
'fonts/fontawesome-webfont.woff',
'fonts/fontawesome-webfont.ttf',
'fonts/fontawesome-webfont.eot',
'images/pop/thinking.svg',
'images/large-spinner.gif',
],
ServiceWorker: {navigateFallbackURL: '/'},
}),
],

node: {
Expand Down
16 changes: 15 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ deep-equal@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"

deep-extend@~0.4.0:
deep-extend@^0.4.0, deep-extend@~0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f"

Expand Down Expand Up @@ -2476,6 +2476,10 @@ ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"

ejs@^2.3.4:
version "2.5.6"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.6.tgz#479636bfa3fe3b1debd52087f0acb204b4f19c88"

electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.14:
version "1.3.15"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.15.tgz#08397934891cbcfaebbd18b82a95b5a481138369"
Expand Down Expand Up @@ -5554,6 +5558,16 @@ obuf@^1.0.0, obuf@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.1.tgz#104124b6c602c6796881a042541d36db43a5264e"

offline-plugin@^4.8.1:
version "4.8.1"
resolved "https://registry.yarnpkg.com/offline-plugin/-/offline-plugin-4.8.1.tgz#1d73457081185777179c29d9d416f71077a0197a"
dependencies:
deep-extend "^0.4.0"
ejs "^2.3.4"
loader-utils "0.2.x"
minimatch "^3.0.3"
slash "^1.0.0"

on-finished@~2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
Expand Down