I think this is a very unusual use case, and I'm not talking about dynamically requiring components with webpack.
I want to be able to deploy "Apps" as Vue components on a completely different backend, so that the backend can return full .vue files over an API. The structure of the backend is irrelevant.
So I need a way in my Vue application to achieve the following:
- User clicks on an "app" name in the frontend Vue application
- "app" name is async-requested at the backend
- backend returns a
.vueSFC file, with HTML, JS and CSS in it - frontend compiles the file to a Vue component with template and functionality
- frontend inserts the component in the view, and the component can interact with the rest of the application (Vuex store etc.)
I found v-runtime-template which seems to be the solution for templates. But this doesn't include the JS part, does it?
Additional: I think I'm trying something like VueJS Dynamic Components, but the request URL has to be set dynamically.
.vuefile means the front end has to interpret any template syntax that that Vue file has including less, scss, pug, and whatever else templating languages your Vue file might utilize. I think you still want the backend interpreting the file, but for the front-end to consume plain JSON definition of the Vue component. That's what Webpack is doing behind the scenes anyway. - zero298