Home > front end >  cookie-universal-nuxt, Page refresh loss cookie data on server
cookie-universal-nuxt, Page refresh loss cookie data on server

Time:06-12

i'm using vuejs, nuxtjs implement cookie-universal-nuxt package.Localhost work everything,but the server does not work after refreshing page.

nuxt.config.js

    export default {
     mode: 'universal',
     ssr: true,
     target: 'server',
     modules: ['cookie-universal-nuxt'],
     server: {
       port: 4002,
       host: 'localhost'
     }
   }

cart.js

$cookies.set('cart', cookieParams, {
   path: '/',
   maxAge: 60 * 60 * 24 * 7
});

CodePudding user response:

If you're using babel, try adding the package to the transpile section in your nuxt.config. Some packages don't work in ssr correctly without this, e.g element-ui, @vuebits/bem, etc.

CodePudding user response:

I also faced same problem. Anyone please help.

  • Related