Rollup-plugin-vue: Feature Request: Support SSR

Created on 6 Jun 2017  路  4Comments  路  Source: vuejs/rollup-plugin-vue

Rollup-plugin-vue relies on the vue-template-compiler vs vue-server-renderer package. As far as I can tell, one major distinction is that vue-server-render sets this line:

process.env.VUE_ENV = 'server';

One of the effects is that it allows you to output things like <script> tags from your template (rather than being stripped). I use using Rollup to generate static HTML files (that get hydrated on load in the browser to a "live" Vue component) based on https://ssr.vuejs.org/en.

So, basically, a feature request would be able to pass something like server: true to rollup-plugin-vue, and have it set process.env.VUE_ENV = 'server'. I know it's a small thing, but hopefully a documented feature would save someone else trying to figure out why Rollup can't generate static HTML using this plugin.

High In Progress Bug

Most helpful comment

@znck What is the current status for this bug? It seems a bit wierd that I have to use version 3.0.0 to use an esm version of mig vue file. And version 3.0.0 do not support <template src="./myFile.html"> which bugs me alot

All 4 comments

@matthew-dean @Justineo Could you explain this requirement a bit more? What are the use cases and how to reproduce the issue you are facing?

@znck if a project depends on certain CSS code it cannot work on server side after building with Rollup. Rollup currently uses document.createElement('style') to inject CSS so it fails on the server. Actually I've got no idea what's the best way to handle this.

As I mentioned in Justineo/vue-awesome#43, maybe users shouldn't use packed version if they want SSR.

@znck What is the current status for this bug? It seems a bit wierd that I have to use version 3.0.0 to use an esm version of mig vue file. And version 3.0.0 do not support <template src="./myFile.html"> which bugs me alot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ale-grosselle picture ale-grosselle  路  4Comments

Tidyzq picture Tidyzq  路  7Comments

Zekfad picture Zekfad  路  6Comments

iassasin picture iassasin  路  6Comments

asanzdj picture asanzdj  路  7Comments