Skip to content

Commit 1dd96a5

Browse files
committed
fix: import composables from #imports
2 parents ae7c4ae + e48282f commit 1dd96a5

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@blokwise/dynamic",
3-
"version": "2.0.0-3",
3+
"version": "2.0.0-4",
44
"description": "Load components initialized through @nuxt/components dyamically.",
55
"author": "Julian Derungs <julian.derungs@deepbase.ch>",
66
"license": "MIT",

src/module.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,22 @@ export default defineNuxtModule<ModuleOptions>({
2727
const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
2828
nuxt.options.build.transpile.push(runtimeDir)
2929

30-
// add blokwise dynamic components
30+
// add blokwise dynamic component
3131
nuxt.hook('components:dirs', (dirs) => {
3232
dirs.push({
33-
path: resolve(runtimeDir, 'components'),
33+
path: resolve(runtimeDir, 'components', 'dynamic'),
3434
prefix: options.prefix
3535
})
3636
})
3737

38+
// add blokwise dynamic fallback component
39+
nuxt.hook('components:dirs', (dirs) => {
40+
dirs.push({
41+
path: resolve(runtimeDir, 'components', 'fallback'),
42+
prefix: 'NuxtDynamicComponent'
43+
})
44+
})
45+
3846
// Add blokwise dynamic composables
3947
nuxt.hook('autoImports:dirs', (dirs) => {
4048
dirs.push(resolve(runtimeDir, 'composables'))

src/runtime/components/Dynamic.vue src/runtime/components/dynamic/Dynamic.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ watch(
115115
if (c.componentNames.includes(componentName.value)) {
116116
return c[componentName.value]
117117
}
118-
return c.NotFound
118+
return c.NuxtDynamicComponentNotFound
119119
})
120120
)
121121
},

0 commit comments

Comments
 (0)