fix corner cases with export (#4699)

fixes #4698
fixes #4700
fixes #4701
fixes #4702
This commit is contained in:
Alex Lam S.L
2021-02-27 02:15:14 +00:00
committed by GitHub
parent 0a42457df6
commit e6ebf827ce
4 changed files with 32 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ exports.strip_exports = function(code) {
var count = 0;
return code.replace(/\bexport(?:\s*\{[^}]*};|\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 "!!" + header;
return header.slice(0, -1) + " _" + ++count + header.slice(-1);
});
};