Reputation: 5738
For an app I need to load dynamic configurations (read from external service) before I can bootstrap my Quasar app.
In other Vue apps I use a require.ensure
or a Promise
in main.js
and load the app after everything else is ready, but since Quasar added the concept of App Plugins this won't work anymore as there is no Promises or Chaining available, resulting in race conditions as the App needs configurations that are not available yet.
I looked at their internals and they seem to load plugins in a forEach
block from an auto-generated file, not ready for this scenario.
Here's an excerp from the usual solution in main.js
(using require.ensure
as the file auto-generated on the same server by another service)
require.ensure(['./config.js'], (require) => {
const config = require('.config.js');
// ... use values in config to bootstrap axios, apollo and such
// And finally start the Vue app
new Vue({ ... })
})
Any ideas on how to do this in a Quasar or Webpack way ?
The only alternative I can think of now is to fork&patch Quasar, but maybe I'm missing something and there is another way.
Upvotes: 1
Views: 69