Add offline support (#699)

* add offline support

* update manifest to use desktop icon

* simplify next-offline config

* don't enable cache control on service workers
main
Michael Fix 6 years ago committed by GitHub
parent 270cb0f5cd
commit 117b4f021a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,2 +1,3 @@
// const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
// const withOffline = require('next-offline')
const withOffline = require('next-offline')
module.exports = withOffline()

@ -7,7 +7,20 @@
{ "src": "^/about(.*)", "dest": "/about" },
{ "src": "^/embed(.*)", "dest": "/embed" },
{ "src": "^/_next/(.*)", "dest": "/_next/$1" },
{ "src": "^/static/(.*)", "dest": "/static/$1" },
{
"src": "^/service-worker.js$",
"dest": "/_next/service-worker.js",
"headers": {
"Service-Worker-Allowed": "/"
}
},
{
"src": "^/static/(.*)",
"dest": "/static/$1",
"headers": {
"cache-control": "public, max-age=43200, immutable"
}
},
{ "src": "^/(.*)", "dest": "/index.html" }
],
"build": {

@ -37,7 +37,7 @@
"morphmorph": "^0.1.0",
"ms": "^2.0.0",
"next": "^8.0.3",
"next-offline": "^3.3.1",
"next-offline": "^3.3.6",
"prettier": "^1.16.4",
"react": "^16.8.3",
"react-click-outside": "^3.0.0",

@ -6,13 +6,16 @@
"description": "Carbon is the easiest way to create and share beautiful images of your source code.",
"display": "standalone",
"start_url": "/",
"icons": [{
"src": "/static/brand/icon.png",
"type": "image/png",
"sizes": "448x448"
}, {
"src": "/static/brand/logo-square.png",
"type": "image/png",
"sizes": "1024x1024"
}]
"icons": [
{
"src": "/static/brand/icon.png",
"type": "image/png",
"sizes": "448x448"
},
{
"src": "/static/brand/desktop.png",
"type": "image/png",
"sizes": "512x512"
}
]
}

@ -4839,10 +4839,10 @@ neo-async@^2.5.0:
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835"
integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==
next-offline@^3.3.1:
version "3.3.5"
resolved "https://registry.yarnpkg.com/next-offline/-/next-offline-3.3.5.tgz#e4c3f33efb0c4f49f3e28abd513ccc3a8fc8080f"
integrity sha512-e6J838mppCpYMnbCvthoOSZNtAj9iFpJdVnCkuQTiIFU9IDP/GxKpjsixfP1UaTyHCmO2GzmyiYaglzFMPeVVQ==
next-offline@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/next-offline/-/next-offline-3.3.6.tgz#3e35ad59d489c641a4d5745f5b06ce45faa53a42"
integrity sha512-hBlGTaWqv9xJf3c4WqjAfb6jO3+Rdfw42p9PQeQlsnO8G0bCg7GUxFebKDcK/b4scFFgmnvp4UNPt1vyMbpQgw==
dependencies:
clean-webpack-plugin "^0.1.19"
copy-webpack-plugin "~4.5.2"

Loading…
Cancel
Save