fix: Remove import * as imports from entrypoints during build (#671)

This commit is contained in:
Aaron
2024-05-24 05:38:53 -05:00
committed by GitHub
parent cb9a9c0530
commit 20bdd8ad2f
2 changed files with 2 additions and 1 deletions
@@ -50,6 +50,7 @@ import "@/utils/github";
import '@/utils/github';
import"@/utils/github"
import'@/utils/github';
import * as abc from "@/utils/github"
`;
expect(removeImportStatements(imports).trim()).toEqual('');
});
+1 -1
View File
@@ -19,7 +19,7 @@ export function safeVarName(str: string): string {
*/
export function removeImportStatements(text: string): string {
return text.replace(
/(import\s?[{\w][\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
/(import\s?[\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
'',
);
}