From 499f0c6e5e2512be292b184fd5ec901047829474 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Thu, 21 Oct 2021 16:38:00 +0300 Subject: [PATCH] refactor: code --- 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;