Open yeahliv opened 5 years ago
ok, it work, set ssr: false
plugins: [
{ src: '~/plugins/vue-js-toggle-button.js', ssr: false }
],
But with ssr: false
it means plugin doesn't support ssr, plugin should be updated and shouldn't refer to document when running on server side
What worked for me was including the generated ssr dist file instead of the default. I don't know how or why a separate file is generated but it works for me 🤷♂
For example in a nuxt plugin: Before:
import Vue from 'vue';
import VueJsToggleButton from 'vue-js-toggle-button';
Vue.use(VueJsToggleButton);
After:
import Vue from 'vue';
import VueJsToggleButton from 'vue-js-toggle-button/dist/ssr.index';
Vue.use(VueJsToggleButton);
Not working when I run nuxt start
@EdwinHoksberg You saved my day! if you need anything from my API let me know!
@euvl @EdwinHoksberg's solution of loading vue-js-toggle-button/dist/ssr.index
should be added to the SSR part of the readme, without it you have to disable SSR or you run into a document is not defined
error
Not working when I run
nuxt start
It's the same issue. Is there any solution?
i think it because nuxt load
dist/index.js
, not load'dist/ssr.index.js