2023-04-07 16:02:47 +00:00
|
|
|
import { addPlugin, createResolver, defineNuxtModule, useNuxt } from 'nuxt/kit'
|
2022-02-15 09:50:11 +00:00
|
|
|
|
|
|
|
export default defineNuxtModule({
|
|
|
|
meta: {
|
|
|
|
name: 'my-module',
|
2024-04-05 18:08:32 +00:00
|
|
|
configKey: 'sampleModule',
|
2022-08-04 15:15:42 +00:00
|
|
|
},
|
|
|
|
setup () {
|
2023-03-03 17:52:55 +00:00
|
|
|
const resolver = createResolver(import.meta.url)
|
|
|
|
|
|
|
|
addPlugin(resolver.resolve('./runtime/plugin'))
|
2022-08-04 15:15:42 +00:00
|
|
|
useNuxt().hook('app:resolve', (app) => {
|
|
|
|
app.middleware.push({
|
|
|
|
name: 'unctx-test',
|
2023-03-03 17:52:55 +00:00
|
|
|
path: resolver.resolve('./runtime/middleware'),
|
2024-04-05 18:08:32 +00:00
|
|
|
global: true,
|
2022-08-04 15:15:42 +00:00
|
|
|
})
|
|
|
|
})
|
2024-04-05 18:08:32 +00:00
|
|
|
},
|
2022-02-15 09:50:11 +00:00
|
|
|
})
|