mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
25 lines
602 B
TypeScript
25 lines
602 B
TypeScript
import { defineNuxtModule, createResolver, addPlugin, useNuxt } from 'nuxt/kit'
|
|
|
|
export default defineNuxtModule({
|
|
defaults: {
|
|
enabled: true,
|
|
typeTest: (value: boolean) => typeof value === 'boolean'
|
|
},
|
|
meta: {
|
|
name: 'my-module',
|
|
configKey: 'sampleModule'
|
|
},
|
|
setup () {
|
|
const resolver = createResolver(import.meta.url)
|
|
|
|
addPlugin(resolver.resolve('./runtime/plugin'))
|
|
useNuxt().hook('app:resolve', (app) => {
|
|
app.middleware.push({
|
|
name: 'unctx-test',
|
|
path: resolver.resolve('./runtime/middleware'),
|
|
global: true
|
|
})
|
|
})
|
|
}
|
|
})
|