From da0b9da2de38df00270b4b500b4e814e93634f0f Mon Sep 17 00:00:00 2001 From: Vince Blom Date: Thu, 26 Aug 2021 10:14:22 -0500 Subject: [PATCH] Configurable Server Middleware Path - adds middlewarePath default as '/_loading' - uses options.middlewarePath for the path of the middleware that is pushed onto the nuxt serverMiddleware stack --- lib/module.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/module.js b/lib/module.js index 1a6056b..8fe4daf 100644 --- a/lib/module.js +++ b/lib/module.js @@ -12,6 +12,7 @@ module.exports = function NuxtLoadingScreen () { const options = this.options.build.loadingScreen = defu(this.options.build.loadingScreen, { baseURL, baseURLAlt: baseURL, + middlewarePath: '/_loading', altPort: false, image: undefined, colors: {} @@ -20,7 +21,7 @@ module.exports = function NuxtLoadingScreen () { const loading = new LoadingUI(options) nuxt.options.serverMiddleware.push({ - path: '/_loading', + path: options.middlewarePath, handler: (req, res) => { loading.app(req, res) } })