Closed ghost closed 6 years ago
Hi @tchret , did you install the plugin in dev mode?
I saw that the documentation (install) was outdated
You must install in production mode.
It works great now, thank you :)
@tchret @anteriovieira I have the plugin in my project dependencies (not devDependencies) but am still getting this error :\ Any other thoughts?
Error
package.json
Can I see how you implemented it in the nuxt.config.js file?
Sure thing! Here is my nuxt.config.js
(minus some project specific stuff)
const path = require('path');
require('dotenv').config({
silent: true,
path: process.env.NODE_ENV === 'production' ? '.prod.env' : '.dev.env'
});
module.exports = {
build: {
extractCSS: true,
vendor: ['jwt-decode', 'axios'],
postcss: [require('autoprefixer')()]
},
buildDir: 'dist/client',
cache: true,
css: ['@/assets/style/main.scss'],
env: {
HOST: process.env.HOST,
PORT: process.env.PORT
},
head: {
// project specific info
},
manifest: {
// project specific info
},
modules: [
'@nuxtjs/pwa',
'@nuxtjs/component-cache',
['nuxt-sass-resources-loader', '@/assets/style/variables.scss']
],
plugins: ['~/plugins/axios', '~/plugins/font-awesome'],
loading: {
color: '#2b67f5'
},
render: {
static: {
maxAge: '1y',
setHeaders(res, path) {
if (path.includes('sw.js')) {
res.setHeader('Cache-Control', 'public, max-age=0');
}
}
}
},
router: {
middleware: ['ssr-cookie', 'https']
},
srcDir: path.resolve(__dirname, 'src', 'client')
};
Hi @anteriovieira,
Thank you for the plugin, really useful for me in dev mode. Unfortunately I can't get it works in production. (I'm trying to deploy the website with
now
)Do you have a tips for me?
Cheers :)