diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 846c091..96a49fd 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -216,11 +216,6 @@ "from": "babel-helpers@>=6.24.1 <7.0.0", "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz" }, - "babel-loader": { - "version": "6.4.1", - "from": "babel-loader@>=6.2.4 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-6.4.1.tgz" - }, "babel-messages": { "version": "6.23.0", "from": "babel-messages@>=6.23.0 <7.0.0", @@ -356,11 +351,6 @@ "from": "babel-plugin-transform-flow-strip-types@>=6.22.0 <7.0.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz" }, - "babel-plugin-transform-object-assign": { - "version": "6.22.0", - "from": "babel-plugin-transform-object-assign@latest", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-assign/-/babel-plugin-transform-object-assign-6.22.0.tgz" - }, "babel-plugin-transform-react-display-name": { "version": "6.23.0", "from": "babel-plugin-transform-react-display-name@>=6.23.0 <7.0.0", @@ -391,21 +381,11 @@ "from": "babel-plugin-transform-strict-mode@>=6.24.1 <7.0.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz" }, - "babel-preset-es2015": { - "version": "6.24.1", - "from": "babel-preset-es2015@6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz" - }, "babel-preset-flow": { "version": "6.23.0", "from": "babel-preset-flow@>=6.23.0 <7.0.0", "resolved": "https://registry.npmjs.org/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz" }, - "babel-preset-react": { - "version": "6.24.1", - "from": "babel-preset-react@6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.24.1.tgz" - }, "babel-register": { "version": "6.24.1", "from": "babel-register@>=6.24.1 <7.0.0", @@ -816,18 +796,6 @@ "from": "css-color-names@0.0.4", "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz" }, - "css-loader": { - "version": "0.27.3", - "from": "css-loader@>=0.27.3 <0.28.0", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-0.27.3.tgz", - "dependencies": { - "loader-utils": { - "version": "1.1.0", - "from": "loader-utils@>=1.0.2 <2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz" - } - } - }, "css-select": { "version": "1.2.0", "from": "css-select@>=1.1.0 <2.0.0", @@ -1103,18 +1071,6 @@ } } }, - "file-loader": { - "version": "0.10.1", - "from": "file-loader@>=0.10.1 <0.11.0", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-0.10.1.tgz", - "dependencies": { - "loader-utils": { - "version": "1.1.0", - "from": "loader-utils@^1.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz" - } - } - }, "filename-regex": { "version": "2.0.1", "from": "filename-regex@>=2.0.0 <3.0.0", @@ -1326,11 +1282,6 @@ "from": "html-minifier@>=3.2.3 <4.0.0", "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.4.1.tgz" }, - "html-webpack-plugin": { - "version": "2.28.0", - "from": "html-webpack-plugin@>=2.22.0 <3.0.0", - "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-2.28.0.tgz" - }, "htmlparser2": { "version": "3.3.0", "from": "htmlparser2@>=3.3.0 <3.4.0", @@ -2114,18 +2065,6 @@ "from": "postcss-load-plugins@>=2.3.0 <3.0.0", "resolved": "https://registry.npmjs.org/postcss-load-plugins/-/postcss-load-plugins-2.3.0.tgz" }, - "postcss-loader": { - "version": "1.3.3", - "from": "postcss-loader@>=1.3.3 <2.0.0", - "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-1.3.3.tgz", - "dependencies": { - "loader-utils": { - "version": "1.1.0", - "from": "loader-utils@^1.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz" - } - } - }, "postcss-media-minmax": { "version": "2.1.2", "from": "postcss-media-minmax@>=2.1.0 <3.0.0", @@ -2317,11 +2256,6 @@ "from": "postcss-zindex@>=2.0.1 <3.0.0", "resolved": "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-2.2.0.tgz" }, - "precss": { - "version": "1.4.0", - "from": "precss@>=1.4.0 <2.0.0", - "resolved": "https://registry.npmjs.org/precss/-/precss-1.4.0.tgz" - }, "prepend-http": { "version": "1.0.4", "from": "prepend-http@>=1.0.0 <2.0.0", @@ -2442,18 +2376,6 @@ "from": "react-hot-api@>=0.4.5 <0.5.0", "resolved": "https://registry.npmjs.org/react-hot-api/-/react-hot-api-0.4.7.tgz" }, - "react-hot-loader": { - "version": "1.3.1", - "from": "react-hot-loader@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/react-hot-loader/-/react-hot-loader-1.3.1.tgz", - "dependencies": { - "source-map": { - "version": "0.4.4", - "from": "source-map@>=0.4.4 <0.5.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz" - } - } - }, "react-toggle-switch": { "version": "2.1.3", "from": "react-toggle-switch@>=2.1.2 <3.0.0", @@ -2882,18 +2804,6 @@ "from": "strip-bom@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz" }, - "style-loader": { - "version": "0.14.1", - "from": "style-loader@>=0.14.1 <0.15.0", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.14.1.tgz", - "dependencies": { - "loader-utils": { - "version": "1.1.0", - "from": "loader-utils@>=1.0.2 <2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz" - } - } - }, "supports-color": { "version": "3.2.3", "from": "supports-color@>=3.2.3 <4.0.0", @@ -3001,18 +2911,6 @@ } } }, - "url-loader": { - "version": "0.5.8", - "from": "url-loader@>=0.5.7 <0.6.0", - "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-0.5.8.tgz", - "dependencies": { - "loader-utils": { - "version": "1.1.0", - "from": "loader-utils@>=1.0.2 <2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz" - } - } - }, "url-parse": { "version": "1.1.8", "from": "url-parse@>=1.1.1 <2.0.0", @@ -3080,55 +2978,11 @@ "from": "wbuf@>=1.4.0 <2.0.0", "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.2.tgz" }, - "webpack": { - "version": "2.4.1", - "from": "webpack@2.4.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-2.4.1.tgz", - "dependencies": { - "camelcase": { - "version": "3.0.0", - "from": "camelcase@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz" - }, - "cliui": { - "version": "3.2.0", - "from": "cliui@>=3.2.0 <4.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz" - }, - "yargs": { - "version": "6.6.0", - "from": "yargs@>=6.0.0 <7.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz" - } - } - }, "webpack-dev-middleware": { "version": "1.10.2", "from": "webpack-dev-middleware@>=1.10.2 <2.0.0", "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.10.2.tgz" }, - "webpack-dev-server": { - "version": "2.4.5", - "from": "webpack-dev-server@2.4.5", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.4.5.tgz", - "dependencies": { - "camelcase": { - "version": "3.0.0", - "from": "camelcase@^3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz" - }, - "cliui": { - "version": "3.2.0", - "from": "cliui@^3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz" - }, - "yargs": { - "version": "6.6.0", - "from": "yargs@^6.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz" - } - } - }, "webpack-sources": { "version": "0.2.3", "from": "webpack-sources@>=0.2.3 <0.3.0", diff --git a/package.json b/package.json index 255a9ea..524bc02 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "precss": "^1.4.0", "react-hot-loader": "^1.3.0", "style-loader": "^0.14.1", + "sw-precache-webpack-plugin": "^0.10.1", "url-loader": "^0.5.7", "webpack": "^2.2.1", "webpack-dev-server": "^2.4.2" diff --git a/webpack.config.prod.js b/webpack.config.prod.js index b518900..c314b79 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -4,8 +4,10 @@ const path = require('path'); const autoprefixer = require('autoprefixer'); const precss = require('precss'); const HtmlWebPackPlugin = require('html-webpack-plugin'); +const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'); module.exports = { + context: __dirname, devtool: 'cheap-module-source-map', entry: [ './src/index' @@ -36,7 +38,17 @@ module.exports = { return [autoprefixer, precss]; } } - }) + }), + new SWPrecacheWebpackPlugin( { + cacheId: 'kana-quiz', + filename: 'sw.js', + maximumFileSizeToCacheInBytes: 4194304, + minify: true, + runtimeCaching: [{ + handler: 'cacheFirst', + urlPattern: /\.(woff2|svg|ttf|eot|woff|html)$/, + }], + }) ], module: { loaders: [ @@ -51,12 +63,12 @@ module.exports = { test: /\.css$/, loaders: ['style-loader', 'css-loader'] }, { - test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/, + test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/, loader: 'url-loader?limit=8192' }, { - test: /\.(eot|ttf)$/, + test: /\.(eot|ttf)$/, loader: 'file-loader' - } + } ] } }; \ No newline at end of file