-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathindex.ts
39 lines (36 loc) · 1.01 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { defineNuxtModule } from '@nuxt/kit'
import { resolve, join } from 'path'
import type { Nuxt } from '@nuxt/schema'
export default defineNuxtModule({
meta: {
// Usually the npm package name of your module - in this case a local modal
name: 'blog-module',
// The key in `nuxt.config` that holds the
configKey: 'blog-module',
// Compatibility constraints
compatibility: {
// Semver version of supported nuxt versions
nuxt: '^3.9.0',
},
},
setup(options: any, nuxt: Nuxt) {
// Auto register components
nuxt.hook('components:dirs', (dirs) => {
dirs.push({
path: join(__dirname, 'components'),
})
})
// Auto register composables
nuxt.hook('imports:dirs', (dirs) => {
dirs.push(resolve(__dirname, './composables'))
})
// Auto register pages
nuxt.hook('pages:extend', (pages) => {
pages.push({
name: 'blog',
path: '/blog',
file: resolve(__dirname, './pages/blog.vue'),
})
})
},
})