In my Vue 3 application, the entry point is main.js:
import { createApp } from 'vue'
import router from './router'
import App from './App.vue'
const app = createApp(App)
app.use(router)
app.mount('#app')
// When I do console.log(app), I see that my app is correctly initialized
export default app
In a separate file called index.js:
import app from '../renderer/src/main.js'
console.log(app)
//...rest of code where I need to use app.component()
An error occurs: ReferenceError: Cannot access 'app' before initialization.
I have verified the paths and they are correct. As stated in the main.js code snippet, my app is indeed initialized as confirmed by the console.log output. However, there seems to be an issue with exporting it properly. My objective is to utilize app.component() and app.use() in another file seamlessly.