V
V
veryoriginalnickname2021-08-21 23:10:53
Vue.js
veryoriginalnickname, 2021-08-21 23:10:53

Export App in Vite?

In Vue I did something like this:

const app =
     createApp(App)
         .use(store)
         .use(router)
         .use(plugin1)
         .use(plugin2)
         .mount('#app')
 export default app

in order to use the progressbar plugin in some Axios, for example.
In Vite, it is no longer possible to export the App, it gives errors like "cannot access router before initalization". How can you export a constant from app?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
veryoriginalnickname, 2021-08-21
@veryoriginalnickname

Through Window it seems to work:

const app =
    const app = createApp(App)
         .use(store)
         .use(router)
         .use(plugin1)
         .use(plugin2)
         .mount('#app')
window.app = app

if someone has better options, then write

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question