perf: use `.indexOf()` instead of `.split()`
This commit is contained in:
parent
e91b530fff
commit
95f4a3d747
|
@ -40,15 +40,9 @@ const sourceMappingURLRegex = RegExp(
|
|||
* @returns {{replacementString: null|string, sourceMappingURL: null|string}} source mapping url
|
||||
*/
|
||||
function getSourceMappingURL(code) {
|
||||
const lines = code.split(/^/m);
|
||||
let match;
|
||||
|
||||
for (let i = lines.length - 1; i >= 0; i--) {
|
||||
match = lines[i].match(sourceMappingURLRegex);
|
||||
if (match) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const lastLineIndex = code.indexOf("\n");
|
||||
const lastLine = code.substring(lastLineIndex + 1);
|
||||
const match = lastLine.match(sourceMappingURLRegex);
|
||||
|
||||
const sourceMappingURL = match ? match[1] || match[2] || "" : null;
|
||||
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
module.exports = [
|
||||
/Failed to parse source map/
|
||||
];
|
||||
module.exports = [/Failed to parse source map/];
|
||||
|
|
Loading…
Reference in New Issue