active le hors ligne pour l'application

pull/294/head
Johan Girod 2018-07-04 19:46:20 +02:00 committed by Mael
parent ab85835796
commit f0f70227cb
4 changed files with 6 additions and 23 deletions

View File

@ -25,8 +25,8 @@
<body>
<div id="js" />
<script async src="https://use.fontawesome.com/1da10bbdec.js"></script>
<script async src="./dist/bundle.js"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en,Intl.~locale.fr,IntersectionObserver&unknown=polyfill"></script>
<script async type="text/javascript" src="/bundle.js"></script>
</body>
</html>

View File

@ -8,7 +8,7 @@ import * as Animate from '../../animate'
type Props = {
hideText: boolean
}
class Hiring extends Component<Props, State> {
class Hiring extends Component<Props, {}> {
render() {
return (
<Animate.fromBottom>

View File

@ -84,7 +84,7 @@ export { anchor }
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker
.register('/sw.js')
.register('/dist/sw.js')
.then(registration => {
console.log('SW registered: ', registration)
})

View File

@ -13,7 +13,8 @@ module.exports = {
},
output: {
path: path.resolve('./dist/'),
filename: '[name].js'
filename: '[name].js',
publicPath: '/dist/'
},
module: {
rules: [
@ -81,7 +82,7 @@ module.exports = {
runtimeCaching: [
{
urlPattern: new RegExp(
'https://fonts.(?:googleapis|gstatic).com/(.*)'
'https://fonts.(?:googleapis|gstatic).com/(.*)|https://cdn.polyfill.io/v2/polyfill.min.js'
),
handler: 'cacheFirst',
options: {
@ -93,24 +94,6 @@ module.exports = {
statuses: [0, 200]
}
}
},
{
urlPattern: /\.(?:js|css)$/,
handler: 'staleWhileRevalidate',
options: {
cacheName: 'static-resources'
}
},
{
urlPattern: /\.(?:png|gif|jpg|jpeg|svg)$/,
handler: 'cacheFirst',
options: {
cacheName: 'images',
expiration: {
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60 // 30 Days
}
}
}
]
})