Commit 676ead7f authored by Pooya Parsa's avatar Pooya Parsa

update nuxt.config.js for pwa preset

parent a5ae65a0
module.exports = { module.exports = {
build: { build: {
extractCSS: true, extractCSS: true,
extend(config, { isClient }) { extend (config, { isClient }) {
config.resolve.alias['create-api'] = `./create-api-${isClient ? 'client' : 'server'}.js` config.resolve.alias['create-api'] = `./create-api-${isClient ? 'client' : 'server'}.js`
} }
}, },
head: { head: {
titleTemplate: 'Nuxt HN | %s', titleTemplate: 'Nuxt HN | %s',
meta: [ meta: [
{ property: 'og:type', content: 'website' },
{ property: 'og:title', content: 'Nuxt.js HackerNews' },
{ property: 'og:description', content: 'HackerNews clone built with Nuxt.js' },
{ {
property: 'og:image', property: 'og:image',
content: 'https://cloud.githubusercontent.com/assets/904724/26784102/0d2f8000-49fc-11e7-8091-2b66901c73ee.png' content: 'https://cloud.githubusercontent.com/assets/904724/26784102/0d2f8000-49fc-11e7-8091-2b66901c73ee.png'
...@@ -25,24 +22,7 @@ module.exports = { ...@@ -25,24 +22,7 @@ module.exports = {
manifest: { manifest: {
name: 'Nuxt Hacker News', name: 'Nuxt Hacker News',
description: 'HackerNews clone built with Nuxt.js', description: 'HackerNews clone built with Nuxt.js',
theme_color: '#41b883', theme_color: '#41b883'
icons: [
{
src: '/favicon.ico',
sizes: '16x16',
type: 'image/x-icon'
},
{
src: '/logo_192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/logo_512.png',
sizes: '512x512',
type: 'image/png'
}
]
}, },
modules: [ modules: [
'@nuxtjs/pwa', '@nuxtjs/pwa',
...@@ -55,8 +35,8 @@ module.exports = { ...@@ -55,8 +35,8 @@ module.exports = {
render: { render: {
static: { static: {
maxAge: '1y', maxAge: '1y',
setHeaders: function (res, path) { setHeaders (res, path) {
if (path.includes('sw.js') || path.includes('workbox-sw.')) { if (path.includes('sw.js')) {
res.setHeader('Cache-Control', 'public, max-age=0') res.setHeader('Cache-Control', 'public, max-age=0')
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment