mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-01 14:33:50 +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() {
|
watchServer() {
|
||||||
const nuxtRestartWatch = _.concat(
|
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),
|
this.options.watch.map(this.nuxt.resolveAlias),
|
||||||
path.join(this.options.rootDir, 'nuxt.config.js')
|
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 {
|
export default {
|
||||||
serverMiddleware: ['~/middleware.js'],
|
serverMiddleware: [
|
||||||
|
'~/middleware.js',
|
||||||
|
(req, res, next) => next()
|
||||||
|
],
|
||||||
watch: ['~/custom.file'],
|
watch: ['~/custom.file'],
|
||||||
hooks(hook) {
|
hooks(hook) {
|
||||||
hook('listen', (server, { port, host }) => {
|
hook('listen', (server, { port, host }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user