fix: resolve build stuck issue with nitro pre-render enabled (#26)
This commit is contained in:
@ -8,6 +8,7 @@ import {
|
|||||||
import type { ConnectOptions } from 'mongoose'
|
import type { ConnectOptions } from 'mongoose'
|
||||||
import defu from 'defu'
|
import defu from 'defu'
|
||||||
import { join } from 'pathe'
|
import { join } from 'pathe'
|
||||||
|
import mongoose from 'mongoose'
|
||||||
import { $fetch } from 'ofetch'
|
import { $fetch } from 'ofetch'
|
||||||
import { version } from '../package.json'
|
import { version } from '../package.json'
|
||||||
import { setupDevToolsUI } from './devtools'
|
import { setupDevToolsUI } from './devtools'
|
||||||
@ -54,6 +55,11 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
options: {},
|
options: {},
|
||||||
modelsDir: 'models',
|
modelsDir: 'models',
|
||||||
},
|
},
|
||||||
|
hooks: {
|
||||||
|
close: () => {
|
||||||
|
mongoose.disconnect()
|
||||||
|
},
|
||||||
|
},
|
||||||
async setup(options, nuxt) {
|
async setup(options, nuxt) {
|
||||||
if (nuxt.options.dev) {
|
if (nuxt.options.dev) {
|
||||||
$fetch('https://registry.npmjs.org/nuxt-mongoose/latest').then((release) => {
|
$fetch('https://registry.npmjs.org/nuxt-mongoose/latest').then((release) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user