Skip to content

Commit

Permalink
fix: small perf improvement (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Oct 21, 2021
1 parent 11708c7 commit 8c4846b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8c4846b

Please sign in to comment.