Skip to content

Commit

Permalink
fix(vue): prevent broken import analysis in mount.js
Browse files Browse the repository at this point in the history
  • Loading branch information
galvez committed Oct 16, 2024
1 parent c950da8 commit 1e3f105
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/fastify-vue/virtual/mount.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import create from '/:create.js'
import * as context from '/:context.js'
import * as root from '/:root.vue'

if (root.mount) {
mount(root.mount)
} else {
mount('#root', 'main')
}

async function mount (...targets) {
async function mountApp (...targets) {
const ctxHydration = await extendContext(window.route, context)
const head = new Head(window.route.head, window.document)
const resolvedRoutes = await hydrateRoutes(routes)
Expand All @@ -38,6 +32,14 @@ async function mount (...targets) {
}
}

const mountMethod = 'mount'

if (mountMethod in root) {
mountApp(root[mountMethod])
} else {
mountApp('#root', 'main')
}

async function extendContext (ctx, {
// The route context initialization function
default: setter,
Expand Down

0 comments on commit 1e3f105

Please sign in to comment.