distributed-vue-applications-loading-components-via-http | example project for the following article | Architecture library
kandi X-RAY | distributed-vue-applications-loading-components-via-http Summary
kandi X-RAY | distributed-vue-applications-loading-components-via-http Summary
This is an example project for the following article:
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of distributed-vue-applications-loading-components-via-http
distributed-vue-applications-loading-components-via-http Key Features
distributed-vue-applications-loading-components-via-http Examples and Code Snippets
Community Discussions
Trending Discussions on distributed-vue-applications-loading-components-via-http
QUESTION
Is it possible to load a vue component dynamically at runtime (in an electron app to build a plugin system)?
- The component is in a specific file
- Its path is only known at runtime
- The component can either be precompiled (if that is possible, don't know) or is compiled at runtime
- A simple example component is listed below
I tried the following approaches, both failing:
Require component
...
ANSWER
Answered 2020-Sep-01 at 21:06You can probably look into async loading:
https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components
and see this for a webpack lazy load example:
https://vuedose.tips/dynamic-imports-in-vue-js-for-better-performance/#the-meat%3A
These are just some things I would research for your requirements.
QUESTION
I set up a repository for 3rd parties to create plugins in our website. Essentially, I based our repo off of Markus Oberlehner's guide here: https://github.com/maoberlehner/distributed-vue-applications-loading-components-via-http.
I only included the files and folders necessary for compiling vue components into js files. I did not include any of his code that is dedicated to including these external js files in another project.
A user can easily compile a vue component into a js file with the following command.
...ANSWER
Answered 2020-Nov-07 at 07:47It is not a caching issue. The client loads the page from the server when it loads, and unless you have some communication from the loaded page to the server, it knows nothing further about the server-side state.
You need to hotreload the client page.
The requires something like browser-sync, or your own socket.io implementation to inform the client that the page has updated.
Remember that the client is decoupled from the server, and has no knowledge of what happens on the server unless the user reloads the page, the client code polls the server for changes, or the server communicates a change to the client over some form of subscription over a websocket.
QUESTION
I am designing an architecture for the Vue 3
app with distributed module-based ownership. Module system will be represented with plugins (seems like the most appropriate solution allowing vuex
module and vue-router
dynamic injects). Each such module/plugin will be developed by dedicated team working within isolated repos. We cannot use npm
package-per-plugin approach as deployment process should be isolated as well, and with npm
approach core app team will have to rebuild app each time npm
package plugin has updates. This means we will have to load such plugins/pages at runtime via http
.
So far this approach by Markus Oberlehner seems like some sort of the way to go - it uses custom Promise
based solution for webpack
's missing "load external url script at runtime" functionality. While it works fine with Vue 2
, Vue 3
gives VNode type: undefined
error.
The above mentioned article offers the following webpack
external component loading solution:
ANSWER
Answered 2020-Aug-26 at 15:15We solved this problem together via chat.
Components built via the Vue 3 vue-cli rely on Vue
being available in the global scope. So in order to render components loaded via the technique described in my article, you need to set window.Vue
to a reference to Vue
itself. Then everything works as expected.
QUESTION
I have something in place where I can build my components using this npx command (run in PowerShell):
...ANSWER
Answered 2020-Jul-15 at 16:28I added this line to the top of my html file:
QUESTION
I'm roughly trying to follow this article to import vue components dynamically from my asp.net core webapi
MyComponent.vue
...ANSWER
Answered 2020-Jul-09 at 08:19The problem here was in external-component.js
It seems that the name
variable should match the name of the actual file passed from the server
This can't just match the name string passed in to the File(bytes, file, "name")
call, but the actual file name in the file system (excluding the .vue
extension)
After setting that value properly it's working fine
QUESTION
I need to be able to import and render a vue component from a asp.net core WebApi
I followed this article to get an idea, and came up with the code below.
The endpoint does get hit, and returns the packaged component string as I expected, but I See these errors in the console:
Refused to execute script from 'https://localhost:44385/api/DistributedComponent/Test' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
and
vue.js:634 [Vue warn]: Failed to resolve async component: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { switch (a.label) { case 0: return [4 /yield/, Object(js_util_external_component__WEBPACK_IMPORTED_MODULE_3["default"])('https://localhost:44385/api/DistributedComponent/Test')]; case 1: return [2 /return/, _a.sent()]; } }); }); } Reason: TypeError: Chaining cycle detected for promise #
I suspect I am not returning the component string correctly, but how should I return it? and How can I use these error messages to help me understand what I'm doing wrong?
external-component.js
...ANSWER
Answered 2020-Jul-08 at 15:00I managed to overcome these errors by updating my controller endpoint to:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install distributed-vue-applications-loading-components-via-http
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page