Skip to content

Commit

Permalink
refactor(optimize-imports): use early return
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Dec 18, 2024
1 parent 6184974 commit 97ddfc7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/preprocessors/optimize-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ export const optimizeImports: SveltePreprocessor<"script"> = () => {
case CarbonSvelte.Components:
rewriteImport(s, node, ({ imported, local }) => {
const import_path = components[imported.name]?.path;
return import_path
? `import ${local.name} from "${import_path}";`
: "";
if (!import_path) return "";
return `import ${local.name} from "${import_path}";`;
});
break;

Expand Down

0 comments on commit 97ddfc7

Please sign in to comment.