mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
Filter out non-strings (serverMiddleware watch fix) (#3771)
* Filter out non-strings * Add serverMiddleware function * Add serverMiddleware function (2) * Add serverMiddleware function (3)
This commit is contained in:
parent
b920f22483
commit
f0f307553f
@ -643,7 +643,9 @@ export default class Builder {
|
||||
|
||||
watchServer() {
|
||||
const nuxtRestartWatch = _.concat(
|
||||
this.options.serverMiddleware.map(this.nuxt.resolveAlias),
|
||||
this.options.serverMiddleware
|
||||
.filter(i => typeof i === 'string')
|
||||
.map(this.nuxt.resolveAlias),
|
||||
this.options.watch.map(this.nuxt.resolveAlias),
|
||||
path.join(this.options.rootDir, 'nuxt.config.js')
|
||||
)
|
||||
|
5
test/fixtures/cli/nuxt.config.js
vendored
5
test/fixtures/cli/nuxt.config.js
vendored
@ -1,5 +1,8 @@
|
||||
export default {
|
||||
serverMiddleware: ['~/middleware.js'],
|
||||
serverMiddleware: [
|
||||
'~/middleware.js',
|
||||
(req, res, next) => next()
|
||||
],
|
||||
watch: ['~/custom.file'],
|
||||
hooks(hook) {
|
||||
hook('listen', (server, { port, host }) => {
|
||||
|
Loading…
Reference in New Issue
Block a user