Dependency Injection with TS



  • Hi, I’ve got a project using plain Vue with Typescript but I’m using Dependency Injection for services… the main problem is that I need to “refactor” this line:

    new Vue({
          router,
          store,
          render: h => h(App)
        }).$mount('#app');
    

    For this one:

    class AppBootstrap {
      constructor() {
        this.loadDependencyContainer();
        this.loadApp();
      }
    
      loadDependencyContainer(): void {
        buildDependencyContainer();
      }
    
      loadApp(): void {
        Vue.config.productionTip = false;
    
        new Vue({
          router,
          store,
          render: h => h(App)
        }).$mount('#app');
      }
    }
    
    new AppBootstrap();
    

    But it has to be in ‘main.ts’ file… but obviously it creates conflict with Quasar…

    Anyone has tried to make something like this?


Log in to reply