Closed mediafreakch closed 7 years ago
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:
VUE_ENV=server browserify --bare --no-browser-field --standalone server -e src/server-entry.js -o dist/server-bundle.js -t vueify -t babelify
The resulting bundle now works with the createBundleRenderer
of vue-server-renderer
.
Hope that helps anyone trying to setup server-side-rendering with vue and browserify!
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