improve export compatibility mode

This commit is contained in:
alexlamsl 2021-02-27 14:35:57 +08:00
parent 13ad10a6b5
commit afb530db7b

View File

@ -53,7 +53,7 @@ exports.strip_exports = function(code) {
var count = 0;
return code.replace(/\bexport(?:\s*\{[^}]*}\s*?(?:$|\n|;)|\s+default\b(?:\s*(\(|\{|class\s*\{|class\s+(?=extends\b)|(?:async\s+)?function\s*(?:\*\s*)?\())?|\b)/g, function(match, header) {
if (!header) return "";
if (header.length == 1) return "!!" + header;
if (header.length == 1) return "0, " + header;
return header.slice(0, -1) + " _" + ++count + header.slice(-1);
});
};