From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server-vie001.gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1741185649; bh=zrmLh2wpCuSjVbgGqISiMpRTt+TOVssBB6XKBbTMeoA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Message-ID:Date:From: Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=PEOCp1P5icc701TQuAen2hVnNwGT2ezCVsNCy0KfQne56IZ9aS+Gg7I8OLprI6Vjd e/zojBqquCQwquM2smKHvdrcjX/ounPUbeX8W8LRG9GhODng/1kbkMpFa1d8xf4E9l 3gh3gQ8jqrnyEd91qw4bHs+InZq7MWCvQA6SikSf0E3ZO3J8wtpPNXomobLjT4bn0c 8rv/XvFewtSWWNhsrekFYgbsAOxdY9zjwJqeJYBbTTlqo6jWfkkc3HQI66gZCMVoP0 08MYq7xXCg9zyVI9g+vjuhoT0kLIaAoH+SFbYAgiHxWSY5tecRmPaRBsYhnEtr/uPy fepgsofA0vAvQ== Received: from localhost.localdomain (unknown [203.217.140.198]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 870DB20B4831; Wed, 5 Mar 2025 14:40:48 +0000 (UTC) From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 02/17] refactor: optimize icon imports to reduce bundle size Date: Wed, 5 Mar 2025 21:40:01 +0700 Message-ID: <20250305144018.267-3-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.46.0.windows.1 In-Reply-To: <20250305144018.267-1-kiizuha@gnuweeb.org> References: <20250305144018.267-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Previously, all lucide-Svelte icons were imported, increasing the bundle size. This update changes the import to only include specific icons, reducing the lucide-svelte-related bundle size. Signed-off-by: Muhammad Rizki --- src/lib/components/customs/app-sidebar.svelte | 4 +++- src/lib/components/ui/input/input-password.svelte | 3 ++- src/lib/constants/navigations.ts | 3 ++- src/routes/(protected)/settings/profile/+page.svelte | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/components/customs/app-sidebar.svelte b/src/lib/components/customs/app-sidebar.svelte index 2fba975..7ccc59c 100644 --- a/src/lib/components/customs/app-sidebar.svelte +++ b/src/lib/components/customs/app-sidebar.svelte @@ -3,7 +3,9 @@ import Separator from "$components/ui/separator/separator.svelte"; import * as Sidebar from "$lib/components/ui/sidebar"; import { useAuth } from "$lib/hooks/auth.svelte"; - import { LogOut, Mails, SquareArrowOutUpRight } from "lucide-svelte"; + import LogOut from "lucide-svelte/icons/log-out"; + import Mails from "lucide-svelte/icons/mails"; + import SquareArrowOutUpRight from "lucide-svelte/icons/square-arrow-out-up-right"; import type { ComponentProps } from "svelte"; import { goto } from "$app/navigation"; import Button from "$components/ui/button/button.svelte"; diff --git a/src/lib/components/ui/input/input-password.svelte b/src/lib/components/ui/input/input-password.svelte index ac1df87..6e2c1ab 100644 --- a/src/lib/components/ui/input/input-password.svelte +++ b/src/lib/components/ui/input/input-password.svelte @@ -3,7 +3,8 @@ import type { HTMLInputAttributes } from "svelte/elements"; import Input from "./input.svelte"; import Button from "$components/ui/button/button.svelte"; - import { EyeIcon, EyeOffIcon } from "lucide-svelte"; + import EyeIcon from "lucide-svelte/icons/eye"; + import EyeOffIcon from "lucide-svelte/icons/eye-off"; let { ref = $bindable(null), diff --git a/src/lib/constants/navigations.ts b/src/lib/constants/navigations.ts index ada0e40..ca5e77b 100644 --- a/src/lib/constants/navigations.ts +++ b/src/lib/constants/navigations.ts @@ -1,5 +1,6 @@ import * as typing from "$typings"; -import { Home, Settings } from "lucide-svelte"; +import Home from "lucide-svelte/icons/home" +import Settings from "lucide-svelte/icons/settings" export const navigations: typing.Navigations[] = [ { diff --git a/src/routes/(protected)/settings/profile/+page.svelte b/src/routes/(protected)/settings/profile/+page.svelte index 442e271..05f62b8 100644 --- a/src/routes/(protected)/settings/profile/+page.svelte +++ b/src/routes/(protected)/settings/profile/+page.svelte @@ -3,7 +3,7 @@ import { superForm } from "sveltekit-superforms"; import { zodClient } from "sveltekit-superforms/adapters"; import { profileSchema } from "$lib/schemas/profile-schema"; - import { Pencil } from "lucide-svelte"; + import Pencil from "lucide-svelte/icons/pencil"; import * as Avatar from "$lib/components/ui/avatar"; import * as Form from "$lib/components/ui/form"; import * as RadioGroup from "$lib/components/ui/radio-group"; @@ -18,7 +18,7 @@ const form = superForm(data.form, { SPA: true, - validators: zodClient(profileSchema), + validators: zodClient(profileSchema) }); const getShortName = () => { -- Muhammad Rizki