Skip to content

Commit

Permalink
refactor: move RegExp to a variable and use RegExp.prototype.test()
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Mar 27, 2023
1 parent 482ec6d commit d9604e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/NormalModuleFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const EMPTY_GENERATOR_OPTIONS = {};
const EMPTY_ELEMENTS = [];

const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/;
const LEADING_DOT_EXTENSION_REGEX = /^[^.]/;

const loaderToIdent = data => {
if (!data.options) {
Expand Down Expand Up @@ -856,7 +857,7 @@ ${hints.join("\n\n")}`;
resolver.options.extensions
);
const expectedExtensions = specifiedExtensions.map(extension => {
if (extension.match(/^[^.]/)) {
if (LEADING_DOT_EXTENSION_REGEX.test(extension)) {
appendResolveExtensionsHint = true;
return `.${extension}`;
}
Expand Down

0 comments on commit d9604e9

Please sign in to comment.