mirror of https://github.com/webpack/webpack.git
fix: strip slash for pretty regexp
This commit is contained in:
commit
ae0393f230
|
|
@ -190,8 +190,10 @@ class ContextModule extends Module {
|
|||
* @returns {string} pretty RegExp
|
||||
*/
|
||||
_prettyRegExp(regexString, stripSlash = true) {
|
||||
const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C");
|
||||
return stripSlash ? str.substring(1, str.length - 1) : str;
|
||||
const str = stripSlash
|
||||
? regexString.source + regexString.flags
|
||||
: regexString + "";
|
||||
return str.replace(/!/g, "%21").replace(/\|/g, "%7C");
|
||||
}
|
||||
|
||||
_createIdentifier() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ it("should replace ! with %21 in the module id string of the context module", fu
|
|||
).id;
|
||||
if (typeof moduleId !== "number")
|
||||
expect(moduleId).toBe(
|
||||
"./context/issue-10969/folder lazy recursive ^(?%21file1\\.js$).*$/"
|
||||
"./context/issue-10969/folder lazy recursive ^(?%21file1\\.js$).*$i"
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue