[Vuejs]-How to use ssr supported packages in vue with vue-server-renderer?

0๐Ÿ‘

โœ…

I have found how to handle ssr.

App.js

if (process.browser) {
  const VueGoogleMaps = require('vue2-google-maps');
  Vue.use(VueGoogleMaps, {
    load: {
      key: 'myKey',
      libraries: 'places',
    },
  });
}

Instead of using import, I used require when it is client rendering.

I will be happy if it helped you. ๐Ÿ˜€

Leave a comment