Thursday, 13 May 2021

Dynamically load vue components and resources into browser

I have a SPA with multiple " custom modules", let´s say 'Module A' and 'Module B'. These modules are very different in nature, and Module A uses several "complex" Vue components and javascript/typescript files (resources) which is irrelevant to Module B, and vice versa.

The user can choose to switch between these modules. I would like to only load the relevant resoures depending on the the user´s choice, so all of the resources in Module A isn´t cluttering up the browsers memory, when Module B is chosen. I am using Webpack for bundling. Is this possible in a SPA?

Maybe an alternate solution could be to use Vue´s 'v-if' or '<componoent :is ...'. But even though, isn´t all the logic loaded in the browser anyway, because of the way webpack is bundling?



from Dynamically load vue components and resources into browser

No comments:

Post a Comment