From 8c4846b3a55770cb7286b1f092e619204503ed7f Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Thu, 21 Oct 2021 16:45:47 +0300 Subject: [PATCH] fix: small perf improvement (#860) --- src/utils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils.js b/src/utils.js index ea569c45..d77af529 100644 --- a/src/utils.js +++ b/src/utils.js @@ -68,7 +68,17 @@ function isRelativePath(str) { return RELATIVE_PATH_REGEXP.test(str); } +// TODO simplify for the next major release function stringifyRequest(loaderContext, request) { + if ( + typeof loaderContext.utils !== "undefined" && + typeof loaderContext.utils.contextify === "function" + ) { + return JSON.stringify( + loaderContext.utils.contextify(loaderContext.context, request) + ); + } + const splitted = request.split("!"); const { context } = loaderContext;