createApp vs app?
See original GitHub issueHi, thanks for this great template!
I’m confused by this https://github.com/antfu/vitesse/blob/776494a657dc297c2615d060592fd93ea086dc80/src/main.ts#L12
- Looks like
ViteSSG
is the equivalent of vue’screateApp
. If so, it would be more clear to say `const app = ViteSSG(…’ - Trying to register a global component doesn’t work
export const createApp = ViteSSG(
App,
{ routes },
(ctx) => {
// install all modules under `modules/`
Object.values(import.meta.globEager('./modules/*.ts')).map(i => i.install?.(ctx))
},
)
console.log('createApp', createApp)
createApp.component('set', set)
gives Uncaught TypeError: createApp.component is not a function
How should that work, please?
- Why is
export
needed?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Creating a Vue Application - Vue.js
The createApp API allows multiple Vue applications to co-exist on the same page, each with its own scope for configuration and global assets:....
Read more >The Benefits of the New Vue 3 App Initialization Code
The createApp function takes a root component ( App.vue ) as an argument and returns a Vue app instance. So the simplest app...
Read more >Vue 3 Tutorial (for Vue 2 Users) - Vue.js Developers
Here's what the app looks like in it's opened and closed states so you ... Under the new API, calling createApp returns a...
Read more >A definitive guide to Vue 3 components - LogRocket Blog
In the above code, the createApp function, from vue , creates an app instance and mounts it to an HTML element with ID...
Read more >Vue CLI: Why does createApp work but Vue.createApp doesn't?
js and the normal version where you use a Vue istance. On the initial build, the App.js file looks something like this: import...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
export
andcreateApp
it’s because Vite SSG needs to import it in the server build, create an App and do the SSR. https://github.com/antfu/vite-ssg#single-page-ssgI am also wondering how we could achieve a global registration from within a
.vue
component, rather than inmain.ts
. The idea would be to create some dynamic components thanks to the payload of an HTTP call and depending on the actual route the user is on.