Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Dec 19, 2024
1 parent d269cc1 commit 53f46ef
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,25 @@ export default defineNuxtModule<ModuleOptions>({

nuxt.options.vue.compilerOptions.isCustomElement = templateCompilerOptions.template.compilerOptions.isCustomElement

const promises: Promise<void>[] = []
nuxt.options.vite.resolve = defu(nuxt.options.vite.resolve, {
dedupe: ['three'],
})

nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
include: ['three'],
})

const promises: Promise<void>[] = [
addComponent({
name: 'TresCanvas',
filePath: resolver.resolve('./runtime/TresCanvas.client.vue'),
}),
addComponent({
name: 'TresCanvas',
filePath: resolver.resolve('./runtime/TresCanvas.server.vue'),
}),
]

for (const mod of new Set([...options.modules, ...coreDeps])) {
if (mod === '@tresjs/core' || mod === '@tresjs/nuxt') {
continue
Expand Down Expand Up @@ -108,27 +126,6 @@ export default defineNuxtModule<ModuleOptions>({

await Promise.all(promises)

nuxt.options.vite.resolve = defu(nuxt.options.vite.resolve, {
dedupe: ['three'],
})

nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
include: ['three'],
})

promises.push(
addComponent({
name: 'TresCanvas',
filePath: resolver.resolve('./runtime/TresCanvas.client.vue'),
}),
addComponent({
name: 'TresCanvas',
filePath: resolver.resolve('./runtime/TresCanvas.server.vue'),
}),
)

await Promise.all(promises)

if (options.devtools) {
setupDevToolsUI(nuxt, resolver)
}
Expand Down

0 comments on commit 53f46ef

Please sign in to comment.