You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 26, 2018. It is now read-only.
I'm trying to get the vue server-side rendering working in a browserify pipeline. Has anyone done this before? Is it possible with vueify?
It seems that the bundle generated by vueify cannot be executed by node. I'm getting this error in the console when accessing route /:
ReferenceError: document is not defined
at Object.exports.insert (__vue_ssr_bundle__:10168:14)
at Object.21../components/Topbar.vue (__vue_ssr_bundle__:11122:65)
at s (__vue_ssr_bundle__:1:682)
at __vue_ssr_bundle__:1:733
at Object.22../App.vue (__vue_ssr_bundle__:11170:12)
at s (__vue_ssr_bundle__:1:682)
at __vue_ssr_bundle__:1:733
at Object.<anonymous> (__vue_ssr_bundle__:11660:12)
at Object.31../app (__vue_ssr_bundle__:11703:4)
at s (__vue_ssr_bundle__:1:682)
Ok I figured that you actually need to pass VUE_ENV=server as a environment variable to browserify when building the server-bundle. In my package.json, that looks like this: VUE_ENV=server browserify -e src/server-entry.js -o dist/server-bundle.js -t vueify
It's not documented anywhere. Would be nice to have it documented somewhere...
I had to supply browserify with the --no-browser-field, --bare and --standalone server flags too. Where server can be any name you choose, this will just export the server-bundle under the given name. My browserify command now looks like this:
Hey,
I'm trying to get the vue server-side rendering working in a browserify pipeline. Has anyone done this before? Is it possible with vueify?
It seems that the bundle generated by vueify cannot be executed by node. I'm getting this error in the console when accessing route
/
:Probably from this line
Yes, I use single file
.vue
components that contain styles. But shouldn't vue-server-renderer be smart enough not to run this in node?Using
vueify 9.4.0
andvue 2.1.4
The text was updated successfully, but these errors were encountered: