From 8db205dae51d6d1a22bd5da1567b28a0d64bdd25 Mon Sep 17 00:00:00 2001 From: Jannik Hollenbach Date: Sat, 24 Jun 2023 22:10:54 +0200 Subject: [PATCH] Only import required function / file Before the entire dist lib was loaded which contains the entire code, a huge bundle. Changing this reduces the amount of code that needs to be loaded. Signed-off-by: Jannik Hollenbach --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index d05479a..8bca22b 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict' var express = require('express') -var swaggerUi = require('swagger-ui-dist') +var getAbsoluteSwaggerFsPath = require('swagger-ui-dist/absolute-path') var favIconHtml = '' + '' var swaggerInit = '' @@ -268,7 +268,7 @@ var swaggerInitFunction = function (swaggerDoc, opts) { var swaggerAssetMiddleware = options => { var opts = options || {} opts.index = false - return express.static(swaggerUi.getAbsoluteFSPath(), opts) + return express.static(getAbsoluteSwaggerFsPath(), opts) } var serveFiles = function (swaggerDoc, opts) {