mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Add server-destroy
This commit is contained in:
parent
5ad640b294
commit
ebc6da4c08
@ -54,6 +54,11 @@ const nuxtConfigFile = resolve(rootDir, argv['config-file'])
|
|||||||
const nuxtConfig = loadNuxtConfig()
|
const nuxtConfig = loadNuxtConfig()
|
||||||
_.defaultsDeep(nuxtConfig, { watchers: { chokidar: { ignoreInitial: true } } })
|
_.defaultsDeep(nuxtConfig, { watchers: { chokidar: { ignoreInitial: true } } })
|
||||||
|
|
||||||
|
// Fail if an error happened
|
||||||
|
process.on('unhandledRejection', function (err) {
|
||||||
|
throw err
|
||||||
|
})
|
||||||
|
|
||||||
// Start dev
|
// Start dev
|
||||||
let dev = startDev()
|
let dev = startDev()
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import ModuleContainer from './module'
|
|||||||
import Renderer from './renderer'
|
import Renderer from './renderer'
|
||||||
import Options from './options'
|
import Options from './options'
|
||||||
import Debug from 'debug'
|
import Debug from 'debug'
|
||||||
|
import enableDestroy from 'server-destroy'
|
||||||
|
|
||||||
const debug = Debug('nuxt:')
|
const debug = Debug('nuxt:')
|
||||||
debug.color = 5
|
debug.color = 5
|
||||||
@ -57,7 +58,8 @@ export default class Nuxt extends Tapable {
|
|||||||
|
|
||||||
// Close server on nuxt close
|
// Close server on nuxt close
|
||||||
this.plugin('close', () => new Promise((resolve, reject) => {
|
this.plugin('close', () => new Promise((resolve, reject) => {
|
||||||
server.close(err => {
|
// Destroy server by forcing every connection to be closed
|
||||||
|
server.destroy(err => {
|
||||||
debug('server closed')
|
debug('server closed')
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err)
|
return reject(err)
|
||||||
@ -68,6 +70,8 @@ export default class Nuxt extends Tapable {
|
|||||||
|
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
// Add server.destroy(cb) method
|
||||||
|
enableDestroy(server)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@
|
|||||||
"rollup-plugin-node-resolve": "^3.0.0",
|
"rollup-plugin-node-resolve": "^3.0.0",
|
||||||
"rollup-plugin-replace": "^1.1.1",
|
"rollup-plugin-replace": "^1.1.1",
|
||||||
"rollup-watch": "^4.0.0",
|
"rollup-watch": "^4.0.0",
|
||||||
|
"server-destroy": "^1.0.1",
|
||||||
"std-mocks": "^1.0.1",
|
"std-mocks": "^1.0.1",
|
||||||
"uglify-js": "^3.0.18"
|
"uglify-js": "^3.0.18"
|
||||||
},
|
},
|
||||||
|
@ -5971,6 +5971,10 @@ serve-static@1.12.3, serve-static@^1.12.3:
|
|||||||
parseurl "~1.3.1"
|
parseurl "~1.3.1"
|
||||||
send "0.15.3"
|
send "0.15.3"
|
||||||
|
|
||||||
|
server-destroy@^1.0.1:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://repository.neo9.pro/content/groups/global-npm/server-destroy/-/server-destroy-1.0.1.tgz#f13bf928e42b9c3e79383e61cc3998b5d14e6cdd"
|
||||||
|
|
||||||
set-blocking@^2.0.0, set-blocking@~2.0.0:
|
set-blocking@^2.0.0, set-blocking@~2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||||
|
Loading…
Reference in New Issue
Block a user