mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-26 06:07:15 +00:00
98d292ae85
Co-authored-by: Daniel Roe <daniel@roe.dev>
24 lines
620 B
TypeScript
24 lines
620 B
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import { defineNuxtModule, addPlugin, useNuxt } from '@nuxt/kit'
|
|
|
|
export default defineNuxtModule({
|
|
defaults: {
|
|
enabled: true,
|
|
typeTest: (value: boolean) => typeof value === 'boolean'
|
|
},
|
|
meta: {
|
|
name: 'my-module',
|
|
configKey: 'sampleModule'
|
|
},
|
|
setup () {
|
|
addPlugin(fileURLToPath(new URL('./runtime/plugin', import.meta.url)))
|
|
useNuxt().hook('app:resolve', (app) => {
|
|
app.middleware.push({
|
|
name: 'unctx-test',
|
|
path: fileURLToPath(new URL('./runtime/middleware', import.meta.url)),
|
|
global: true
|
|
})
|
|
})
|
|
}
|
|
})
|