add sw-precache
This commit is contained in:
parent
6cbe26f917
commit
b9ef320d18
1092
npm-shrinkwrap.json
generated
1092
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load diff
|
@ -32,6 +32,7 @@
|
||||||
"precss": "^1.4.0",
|
"precss": "^1.4.0",
|
||||||
"react-hot-loader": "^1.3.0",
|
"react-hot-loader": "^1.3.0",
|
||||||
"style-loader": "^0.14.1",
|
"style-loader": "^0.14.1",
|
||||||
|
"sw-precache-webpack-plugin": "^0.10.1",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^2.2.1",
|
"webpack": "^2.2.1",
|
||||||
"webpack-dev-server": "^2.4.2"
|
"webpack-dev-server": "^2.4.2"
|
||||||
|
|
|
@ -4,8 +4,10 @@ const path = require('path');
|
||||||
const autoprefixer = require('autoprefixer');
|
const autoprefixer = require('autoprefixer');
|
||||||
const precss = require('precss');
|
const precss = require('precss');
|
||||||
const HtmlWebPackPlugin = require('html-webpack-plugin');
|
const HtmlWebPackPlugin = require('html-webpack-plugin');
|
||||||
|
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
context: __dirname,
|
||||||
devtool: 'cheap-module-source-map',
|
devtool: 'cheap-module-source-map',
|
||||||
entry: [
|
entry: [
|
||||||
'./src/index'
|
'./src/index'
|
||||||
|
@ -36,7 +38,17 @@ module.exports = {
|
||||||
return [autoprefixer, precss];
|
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: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
|
@ -51,12 +63,12 @@ module.exports = {
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
loaders: ['style-loader', 'css-loader']
|
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'
|
loader: 'url-loader?limit=8192'
|
||||||
}, {
|
}, {
|
||||||
test: /\.(eot|ttf)$/,
|
test: /\.(eot|ttf)$/,
|
||||||
loader: 'file-loader'
|
loader: 'file-loader'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in a new issue