add offline support via service worker
This commit is contained in:
parent
b6a529d5af
commit
ddadcdd7ca
@ -14,9 +14,6 @@ framework:
|
|||||||
php_errors:
|
php_errors:
|
||||||
log: true
|
log: true
|
||||||
|
|
||||||
assets:
|
|
||||||
version_strategy: 'assets.modified_time_version_strategy'
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
# Put the unique name of your app here: the prefix seed
|
# Put the unique name of your app here: the prefix seed
|
||||||
# is used to compute stable namespaces for cache keys.
|
# is used to compute stable namespaces for cache keys.
|
||||||
|
@ -38,7 +38,7 @@ Vue.use(Vuex);
|
|||||||
|
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
window.addEventListener('load', function() {
|
window.addEventListener('load', function() {
|
||||||
navigator.serviceWorker.register('/dist/service-worker.js');
|
navigator.serviceWorker.register('/service-worker.js');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -60,7 +60,14 @@ const config = {
|
|||||||
new MiniCssExtractPlugin({ filename: '[name].css' }),
|
new MiniCssExtractPlugin({ filename: '[name].css' }),
|
||||||
new CopyWebpackPlugin([{ from: './resources/images/', to: '../images/', ignore: ['*.ai'] }]),
|
new CopyWebpackPlugin([{ from: './resources/images/', to: '../images/', ignore: ['*.ai'] }]),
|
||||||
new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }),
|
new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }),
|
||||||
new GenerateSW()
|
new GenerateSW({
|
||||||
|
navigationPreload: true,
|
||||||
|
runtimeCaching: [{
|
||||||
|
urlPattern: ({event}) => event.request.mode === 'navigate',
|
||||||
|
handler: 'NetworkFirst',
|
||||||
|
}],
|
||||||
|
swDest: '../service-worker.js'
|
||||||
|
})
|
||||||
],
|
],
|
||||||
optimization: {
|
optimization: {
|
||||||
minimizer: [
|
minimizer: [
|
||||||
|
Loading…
Reference in New Issue
Block a user