2023-09-28 10:08:02 +00:00
|
|
|
import { addServerHandler, addServerImports, addServerImportsDir, createResolver, defineNuxtModule } from 'nuxt/kit'
|
2023-03-03 17:52:55 +00:00
|
|
|
|
|
|
|
export default defineNuxtModule({
|
|
|
|
meta: {
|
2024-04-05 18:08:32 +00:00
|
|
|
name: 'auto-registered-module',
|
2023-03-03 17:52:55 +00:00
|
|
|
},
|
|
|
|
setup () {
|
|
|
|
const resolver = createResolver(import.meta.url)
|
|
|
|
|
|
|
|
addServerHandler({
|
|
|
|
handler: resolver.resolve('./runtime/handler'),
|
2024-04-05 18:08:32 +00:00
|
|
|
route: '/auto-registered-module',
|
2023-03-03 17:52:55 +00:00
|
|
|
})
|
2023-09-28 10:08:02 +00:00
|
|
|
|
|
|
|
addServerImports([{
|
|
|
|
from: resolver.resolve('./runtime/some-server-import'),
|
|
|
|
name: 'serverAutoImported',
|
2024-04-05 18:08:32 +00:00
|
|
|
as: 'autoimportedFunction',
|
2023-09-28 10:08:02 +00:00
|
|
|
}, {
|
|
|
|
from: resolver.resolve('./runtime/some-server-import'),
|
2024-04-05 18:08:32 +00:00
|
|
|
name: 'someUtils',
|
2023-09-28 10:08:02 +00:00
|
|
|
}])
|
|
|
|
|
2023-10-31 13:16:01 +00:00
|
|
|
addServerImportsDir(resolver.resolve('./runtime/server/utils'))
|
2024-04-05 18:08:32 +00:00
|
|
|
},
|
2023-03-03 17:52:55 +00:00
|
|
|
})
|