refactor: use server auto-imports (#1675)
This commit is contained in:
parent
7da49afde5
commit
f04b09a40d
6 changed files with 12 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
import { rm } from 'fs/promises'
|
||||
import { addImports, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
||||
import { addImports, addImportsSources, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
||||
|
||||
export default defineNuxtModule({
|
||||
meta: {
|
||||
|
@ -38,6 +38,14 @@ export default defineNuxtModule({
|
|||
config.scanDirs = []
|
||||
})
|
||||
|
||||
addImportsSources({
|
||||
from: 'h3',
|
||||
imports: ['defineEventHandler', 'getQuery', 'getRouterParams', 'readBody', 'sendRedirect'] as Array<keyof typeof import('h3')>,
|
||||
})
|
||||
|
||||
nuxt.options.imports.dirs = nuxt.options.imports.dirs || []
|
||||
nuxt.options.imports.dirs.push(resolve('../../server/utils'))
|
||||
|
||||
addImports({ name: 'useStorage', from: resolve('./runtime/storage') })
|
||||
|
||||
addPlugin(resolve('./runtime/logging.client'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue