2022-08-04 15:15:42 +00:00
|
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import { defineNuxtModule, addPlugin, useNuxt } from '@nuxt/kit'
|
2022-02-15 09:50:11 +00:00
|
|
|
|
|
|
|
export default defineNuxtModule({
|
|
|
|
defaults: {
|
|
|
|
enabled: true
|
|
|
|
},
|
|
|
|
meta: {
|
|
|
|
name: 'my-module',
|
|
|
|
configKey: 'sampleModule'
|
2022-08-04 15:15:42 +00:00
|
|
|
},
|
|
|
|
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
|
|
|
|
})
|
|
|
|
})
|
2022-02-15 09:50:11 +00:00
|
|
|
}
|
|
|
|
})
|