diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index 522498912..3701a7a5c 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -217,6 +217,7 @@ "tailwindcss": "^3.4.0", "vite-plugin-checker": "^0.6.2", "vite-plugin-pwa": "^0.17.0", + "vite-plugin-webpackchunkname": "^1.0.3", "vitest": "^1.0.0" }, "resolutions": { diff --git a/packages/pl-fe/src/features/ui/components/modal-root.tsx b/packages/pl-fe/src/features/ui/components/modal-root.tsx index b643e3a8d..e86b327a3 100644 --- a/packages/pl-fe/src/features/ui/components/modal-root.tsx +++ b/packages/pl-fe/src/features/ui/components/modal-root.tsx @@ -11,44 +11,44 @@ import ModalLoading from './modal-loading'; /* eslint sort-keys: "error" */ const MODAL_COMPONENTS = { - ACCOUNT_MODERATION: lazy(() => import('pl-fe/features/ui/components/modals/account-moderation-modal')), - BIRTHDAYS: lazy(() => import('pl-fe/features/ui/components/modals/birthdays-modal')), - BOOST: lazy(() => import('pl-fe/features/ui/components/modals/boost-modal')), - COMPARE_HISTORY: lazy(() => import('pl-fe/features/ui/components/modals/compare-history-modal')), - COMPONENT: lazy(() => import('pl-fe/features/ui/components/modals/component-modal')), - COMPOSE: lazy(() => import('pl-fe/features/ui/components/modals/compose-modal')), - COMPOSE_EVENT: lazy(() => import('pl-fe/features/ui/components/modals/compose-event-modal')), - CONFIRM: lazy(() => import('pl-fe/features/ui/components/modals/confirmation-modal')), - CREATE_GROUP: lazy(() => import('pl-fe/features/ui/components/modals/manage-group-modal')), + ACCOUNT_MODERATION: lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/ui/components/modals/account-moderation-modal')), + BIRTHDAYS: lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/modals/birthdays-modal')), + BOOST: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/boost-modal')), + COMPARE_HISTORY: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/compare-history-modal')), + COMPONENT: lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/modals/component-modal')), + COMPOSE: lazy(() => import(/* webpackChunkName: "compose" */ 'pl-fe/features/ui/components/modals/compose-modal')), + COMPOSE_EVENT: lazy(() => import(/* webpackChunkName: "compose" */ 'pl-fe/features/ui/components/modals/compose-event-modal')), + CONFIRM: lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/modals/confirmation-modal')), + CREATE_GROUP: lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/ui/components/modals/manage-group-modal')), CRYPTO_DONATE: lazy(() => import('pl-fe/features/ui/components/modals/crypto-donate-modal')), - DISLIKES: lazy(() => import('pl-fe/features/ui/components/modals/dislikes-modal')), - DROPDOWN_MENU: lazy(() => import('pl-fe/features/ui/components/modals/dropdown-menu-modal')), - EDIT_ANNOUNCEMENT: lazy(() => import('pl-fe/features/ui/components/modals/edit-announcement-modal')), - EDIT_BOOKMARK_FOLDER: lazy(() => import('pl-fe/features/ui/components/modals/edit-bookmark-folder-modal')), - EDIT_DOMAIN: lazy(() => import('pl-fe/features/ui/components/modals/edit-domain-modal')), - EDIT_FEDERATION: lazy(() => import('pl-fe/features/ui/components/modals/edit-federation-modal')), - EDIT_RULE: lazy(() => import('pl-fe/features/ui/components/modals/edit-rule-modal')), - EMBED: lazy(() => import('pl-fe/features/ui/components/modals/embed-modal')), - EVENT_MAP: lazy(() => import('pl-fe/features/ui/components/modals/event-map-modal')), - EVENT_PARTICIPANTS: lazy(() => import('pl-fe/features/ui/components/modals/event-participants-modal')), - FAMILIAR_FOLLOWERS: lazy(() => import('pl-fe/features/ui/components/modals/familiar-followers-modal')), - FAVOURITES: lazy(() => import('pl-fe/features/ui/components/modals/favourites-modal')), - HOTKEYS: lazy(() => import('pl-fe/features/ui/components/modals/hotkeys-modal')), - JOIN_EVENT: lazy(() => import('pl-fe/features/ui/components/modals/join-event-modal')), - LIST_ADDER: lazy(() => import('pl-fe/features/ui/components/modals/list-adder-modal')), - LIST_EDITOR: lazy(() => import('pl-fe/features/ui/components/modals/list-editor-modal')), - MEDIA: lazy(() => import('pl-fe/features/ui/components/modals/media-modal')), - MENTIONS: lazy(() => import('pl-fe/features/ui/components/modals/mentions-modal')), - MISSING_DESCRIPTION: lazy(() => import('pl-fe/features/ui/components/modals/missing-description-modal')), - MUTE: lazy(() => import('pl-fe/features/ui/components/modals/mute-modal')), - REACTIONS: lazy(() => import('pl-fe/features/ui/components/modals/reactions-modal')), - REBLOGS: lazy(() => import('pl-fe/features/ui/components/modals/reblogs-modal')), - REPLY_MENTIONS: lazy(() => import('pl-fe/features/ui/components/modals/reply-mentions-modal')), - REPORT: lazy(() => import('pl-fe/features/ui/components/modals/report-modal')), - SELECT_BOOKMARK_FOLDER: lazy(() => import('pl-fe/features/ui/components/modals/select-bookmark-folder-modal')), - TEXT_FIELD: lazy(() => import('pl-fe/features/ui/components/modals/text-field-modal')), - UNAUTHORIZED: lazy(() => import('pl-fe/features/ui/components/modals/unauthorized-modal')), - VIDEO: lazy(() => import('pl-fe/features/ui/components/modals/video-modal')), + DISLIKES: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/dislikes-modal')), + DROPDOWN_MENU: lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/modals/dropdown-menu-modal')), + EDIT_ANNOUNCEMENT: lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/ui/components/modals/edit-announcement-modal')), + EDIT_BOOKMARK_FOLDER: lazy(() => import(/* webpackChunkName: "bookmarks" */ 'pl-fe/features/ui/components/modals/edit-bookmark-folder-modal')), + EDIT_DOMAIN: lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/ui/components/modals/edit-domain-modal')), + EDIT_FEDERATION: lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/ui/components/modals/edit-federation-modal')), + EDIT_RULE: lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/ui/components/modals/edit-rule-modal')), + EMBED: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/embed-modal')), + EVENT_MAP: lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/ui/components/modals/event-map-modal')), + EVENT_PARTICIPANTS: lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/ui/components/modals/event-participants-modal')), + FAMILIAR_FOLLOWERS: lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/modals/familiar-followers-modal')), + FAVOURITES: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/favourites-modal')), + HOTKEYS: lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/modals/hotkeys-modal')), + JOIN_EVENT: lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/ui/components/modals/join-event-modal')), + LIST_ADDER: lazy(() => import(/* webpackChunkName: "lists" */ 'pl-fe/features/ui/components/modals/list-adder-modal')), + LIST_EDITOR: lazy(() => import(/* webpackChunkName: "lists" */ 'pl-fe/features/ui/components/modals/list-editor-modal')), + MEDIA: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/media-modal')), + MENTIONS: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/mentions-modal')), + MISSING_DESCRIPTION: lazy(() => import(/* webpackChunkName: "compose" */ 'pl-fe/features/ui/components/modals/missing-description-modal')), + MUTE: lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/modals/mute-modal')), + REACTIONS: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/reactions-modal')), + REBLOGS: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/reblogs-modal')), + REPLY_MENTIONS: lazy(() => import(/* webpackChunkName: "compose" */ 'pl-fe/features/ui/components/modals/reply-mentions-modal')), + REPORT: lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/modals/report-modal')), + SELECT_BOOKMARK_FOLDER: lazy(() => import(/* webpackChunkName: "bookmarks" */ 'pl-fe/features/ui/components/modals/select-bookmark-folder-modal')), + TEXT_FIELD: lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/modals/text-field-modal')), + UNAUTHORIZED: lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/ui/components/modals/unauthorized-modal')), + VIDEO: lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/ui/components/modals/video-modal')), }; type ModalType = keyof typeof MODAL_COMPONENTS | null; diff --git a/packages/pl-fe/src/features/ui/util/async-components.ts b/packages/pl-fe/src/features/ui/util/async-components.ts index e539a09d9..a955c879a 100644 --- a/packages/pl-fe/src/features/ui/util/async-components.ts +++ b/packages/pl-fe/src/features/ui/util/async-components.ts @@ -2,127 +2,127 @@ import { lazy } from 'react'; // Pages export const AboutPage = lazy(() => import('pl-fe/features/about')); -export const AccountGallery = lazy(() => import('pl-fe/features/account-gallery')); -export const AccountTimeline = lazy(() => import('pl-fe/features/account-timeline')); -export const Aliases = lazy(() => import('pl-fe/features/aliases')); -export const Announcements = lazy(() => import('pl-fe/features/admin/announcements')); -export const AuthTokenList = lazy(() => import('pl-fe/features/auth-token-list')); -export const Backups = lazy(() => import('pl-fe/features/backups')); -export const Blocks = lazy(() => import('pl-fe/features/blocks')); -export const BookmarkFolders = lazy(() => import('pl-fe/features/bookmark-folders')); -export const Bookmarks = lazy(() => import('pl-fe/features/bookmarks')); -export const BubbleTimeline = lazy(() => import('pl-fe/features/bubble-timeline')); -export const ChatIndex = lazy(() => import('pl-fe/features/chats')); +export const AccountGallery = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/account-gallery')); +export const AccountTimeline = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/account-timeline')); +export const Aliases = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/aliases')); +export const Announcements = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin/announcements')); +export const AuthTokenList = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/auth-token-list')); +export const Backups = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/backups')); +export const Blocks = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/blocks')); +export const BookmarkFolders = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/bookmark-folders')); +export const Bookmarks = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/bookmarks')); +export const BubbleTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/bubble-timeline')); +export const ChatIndex = lazy(() => import(/* webpackChunkName: "chats" */ 'pl-fe/features/chats')); export const Circle = lazy(() => import('pl-fe/features/circle')); -export const CommunityTimeline = lazy(() => import('pl-fe/features/community-timeline')); -export const ComposeEditor = lazy(() => import('pl-fe/features/compose/editor')); -export const Conversations = lazy(() => import('pl-fe/features/conversations')); -export const CreateApp = lazy(() => import('pl-fe/features/developers/apps/create')); +export const CommunityTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/community-timeline')); +export const ComposeEditor = lazy(() => import(/* webpackChunkName: "compose" */ 'pl-fe/features/compose/editor')); +export const Conversations = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/conversations')); +export const CreateApp = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/developers/apps/create')); export const CryptoDonate = lazy(() => import('pl-fe/features/crypto-donate')); -export const Dashboard = lazy(() => import('pl-fe/features/admin')); -export const DeleteAccount = lazy(() => import('pl-fe/features/delete-account')); -export const Developers = lazy(() => import('pl-fe/features/developers')); -export const Directory = lazy(() => import('pl-fe/features/directory')); -export const DomainBlocks = lazy(() => import('pl-fe/features/domain-blocks')); -export const Domains = lazy(() => import('pl-fe/features/admin/domains')); +export const Dashboard = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin')); +export const DeleteAccount = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/delete-account')); +export const Developers = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/developers')); +export const Directory = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/directory')); +export const DomainBlocks = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/domain-blocks')); +export const Domains = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin/domains')); export const DraftStatuses = lazy(() => import('pl-fe/features/draft-statuses')); -export const EditEmail = lazy(() => import('pl-fe/features/edit-email')); -export const EditFilter = lazy(() => import('pl-fe/features/filters/edit-filter')); -export const EditGroup = lazy(() => import('pl-fe/features/group/edit-group')); -export const EditPassword = lazy(() => import('pl-fe/features/edit-password')); -export const EditProfile = lazy(() => import('pl-fe/features/edit-profile')); -export const EventDiscussion = lazy(() => import('pl-fe/features/event/event-discussion')); -export const EventInformation = lazy(() => import('pl-fe/features/event/event-information')); -export const Events = lazy(() => import('pl-fe/features/events')); -export const ExportData = lazy(() => import('pl-fe/features/export-data')); -export const ExternalLogin = lazy(() => import('pl-fe/features/external-login')); -export const FavouritedStatuses = lazy(() => import('pl-fe/features/favourited-statuses')); +export const EditEmail = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/edit-email')); +export const EditFilter = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/filters/edit-filter')); +export const EditGroup = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/group/edit-group')); +export const EditPassword = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/edit-password')); +export const EditProfile = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/edit-profile')); +export const EventDiscussion = lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/event/event-discussion')); +export const EventInformation = lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/event/event-information')); +export const Events = lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/events')); +export const ExportData = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/export-data')); +export const ExternalLogin = lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/external-login')); +export const FavouritedStatuses = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/favourited-statuses')); export const FederationRestrictions = lazy(() => import('pl-fe/features/federation-restrictions')); -export const Filters = lazy(() => import('pl-fe/features/filters')); -export const FollowedTags = lazy(() => import('pl-fe/features/followed-tags')); -export const Followers = lazy(() => import('pl-fe/features/followers')); -export const Following = lazy(() => import('pl-fe/features/following')); -export const FollowRecommendations = lazy(() => import('pl-fe/features/follow-recommendations')); -export const FollowRequests = lazy(() => import('pl-fe/features/follow-requests')); -export const GenericNotFound = lazy(() => import('pl-fe/features/generic-not-found')); -export const GroupBlockedMembers = lazy(() => import('pl-fe/features/group/group-blocked-members')); -export const GroupGallery = lazy(() => import('pl-fe/features/group/group-gallery')); -export const GroupMembers = lazy(() => import('pl-fe/features/group/group-members')); -export const GroupMembershipRequests = lazy(() => import('pl-fe/features/group/group-membership-requests')); -export const Groups = lazy(() => import('pl-fe/features/groups')); -export const GroupTimeline = lazy(() => import('pl-fe/features/group/group-timeline')); -export const HashtagTimeline = lazy(() => import('pl-fe/features/hashtag-timeline')); -export const HomeTimeline = lazy(() => import('pl-fe/features/home-timeline')); -export const ImportData = lazy(() => import('pl-fe/features/import-data')); -export const IntentionalError = lazy(() => import('pl-fe/features/intentional-error')); -export const InteractionPolicies = lazy(() => import('pl-fe/features/interaction-policies')); -export const LandingTimeline = lazy(() => import('pl-fe/features/landing-timeline')); -export const Lists = lazy(() => import('pl-fe/features/lists')); -export const ListTimeline = lazy(() => import('pl-fe/features/list-timeline')); -export const LoginPage = lazy(() => import('pl-fe/features/auth-login/components/login-page')); -export const LogoutPage = lazy(() => import('pl-fe/features/auth-login/components/logout')); -export const ManageGroup = lazy(() => import('pl-fe/features/group/manage-group')); -export const MediaGallery = lazy(() => import('pl-fe/components/media-gallery')); -export const Migration = lazy(() => import('pl-fe/features/migration')); -export const ModerationLog = lazy(() => import('pl-fe/features/admin/moderation-log')); -export const Mutes = lazy(() => import('pl-fe/features/mutes')); -export const NewStatus = lazy(() => import('pl-fe/features/new-status')); +export const Filters = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/filters')); +export const FollowedTags = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/followed-tags')); +export const Followers = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/followers')); +export const Following = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/following')); +export const FollowRecommendations = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/follow-recommendations')); +export const FollowRequests = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/follow-requests')); +export const GenericNotFound = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/generic-not-found')); +export const GroupBlockedMembers = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/group/group-blocked-members')); +export const GroupGallery = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/group/group-gallery')); +export const GroupMembers = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/group/group-members')); +export const GroupMembershipRequests = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/group/group-membership-requests')); +export const Groups = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/groups')); +export const GroupTimeline = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/group/group-timeline')); +export const HashtagTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/hashtag-timeline')); +export const HomeTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/home-timeline')); +export const ImportData = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/import-data')); +export const IntentionalError = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/intentional-error')); +export const InteractionPolicies = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/interaction-policies')); +export const LandingTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/landing-timeline')); +export const Lists = lazy(() => import(/* webpackChunkName: "lists" */ 'pl-fe/features/lists')); +export const ListTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/list-timeline')); +export const LoginPage = lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/auth-login/components/login-page')); +export const LogoutPage = lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/auth-login/components/logout')); +export const ManageGroup = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/group/manage-group')); +export const MediaGallery = lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/components/media-gallery')); +export const Migration = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/migration')); +export const ModerationLog = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin/moderation-log')); +export const Mutes = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/mutes')); +export const NewStatus = lazy(() => import(/* webpackChunkName: "compose" */ 'pl-fe/features/new-status')); export const Notifications = lazy(() => import('pl-fe/features/notifications')); -export const PasswordReset = lazy(() => import('pl-fe/features/auth-login/components/password-reset')); -export const PinnedStatuses = lazy(() => import('pl-fe/features/pinned-statuses')); -export const PlFeConfig = lazy(() => import('pl-fe/features/pl-fe-config')); -export const PublicTimeline = lazy(() => import('pl-fe/features/public-timeline')); -export const Quotes = lazy(() => import('pl-fe/features/quotes')); -export const RegisterInvite = lazy(() => import('pl-fe/features/register-invite')); -export const RegistrationPage = lazy(() => import('pl-fe/features/auth-login/components/registration-page')); -export const Relays = lazy(() => import('pl-fe/features/admin/relays')); -export const RemoteTimeline = lazy(() => import('pl-fe/features/remote-timeline')); -export const Rules = lazy(() => import('pl-fe/features/admin/rules')); +export const PasswordReset = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/auth-login/components/password-reset')); +export const PinnedStatuses = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/pinned-statuses')); +export const PlFeConfig = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/pl-fe-config')); +export const PublicTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/public-timeline')); +export const Quotes = lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/quotes')); +export const RegisterInvite = lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/register-invite')); +export const RegistrationPage = lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/auth-login/components/registration-page')); +export const Relays = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin/relays')); +export const RemoteTimeline = lazy(() => import(/* webpackChunkName: "timelines" */ 'pl-fe/features/remote-timeline')); +export const Rules = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin/rules')); export const ScheduledStatuses = lazy(() => import('pl-fe/features/scheduled-statuses')); export const Search = lazy(() => import('pl-fe/features/search')); export const ServerInfo = lazy(() => import('pl-fe/features/server-info')); -export const ServiceWorkerInfo = lazy(() => import('pl-fe/features/developers/service-worker-info')); -export const Settings = lazy(() => import('pl-fe/features/settings')); -export const SettingsStore = lazy(() => import('pl-fe/features/developers/settings-store')); -export const Share = lazy(() => import('pl-fe/features/share')); -export const Status = lazy(() => import('pl-fe/features/status')); -export const TestTimeline = lazy(() => import('pl-fe/features/test-timeline')); -export const ThemeEditor = lazy(() => import('pl-fe/features/theme-editor')); -export const UserIndex = lazy(() => import('pl-fe/features/admin/user-index')); +export const ServiceWorkerInfo = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/developers/service-worker-info')); +export const Settings = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/settings')); +export const SettingsStore = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/developers/settings-store')); +export const Share = lazy(() => import(/* webpackChunkName: "compose" */ 'pl-fe/features/share')); +export const Status = lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/status')); +export const TestTimeline = lazy(() => import(/* webpackChunkName: "settings" */ 'pl-fe/features/test-timeline')); +export const ThemeEditor = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/theme-editor')); +export const UserIndex = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin/user-index')); // Panels -export const AccountNotePanel = lazy(() => import('pl-fe/features/ui/components/panels/account-note-panel')); -export const AnnouncementsPanel = lazy(() => import('pl-fe/components/announcements/announcements-panel')); -export const BirthdayPanel = lazy(() => import('pl-fe/components/birthday-panel')); -export const CryptoDonatePanel = lazy(() => import('pl-fe/features/crypto-donate/components/crypto-donate-panel')); -export const GroupMediaPanel = lazy(() => import('pl-fe/features/ui/components/panels/group-media-panel')); -export const InstanceInfoPanel = lazy(() => import('pl-fe/features/ui/components/panels/instance-info-panel')); -export const InstanceModerationPanel = lazy(() => import('pl-fe/features/ui/components/panels/instance-moderation-panel')); -export const LatestAccountsPanel = lazy(() => import('pl-fe/features/admin/components/latest-accounts-panel')); -export const MyGroupsPanel = lazy(() => import('pl-fe/features/ui/components/panels/my-groups-panel')); -export const NewEventPanel = lazy(() => import('pl-fe/features/ui/components/panels/new-event-panel')); -export const NewGroupPanel = lazy(() => import('pl-fe/features/ui/components/panels/new-group-panel')); -export const PinnedAccountsPanel = lazy(() => import('pl-fe/features/ui/components/panels/pinned-accounts-panel')); -export const ProfileFieldsPanel = lazy(() => import('pl-fe/features/ui/components/panels/profile-fields-panel')); -export const ProfileInfoPanel = lazy(() => import('pl-fe/features/ui/components/panels/profile-info-panel')); -export const ProfileMediaPanel = lazy(() => import('pl-fe/features/ui/components/panels/profile-media-panel')); -export const PromoPanel = lazy(() => import('pl-fe/features/ui/components/panels/promo-panel')); -export const SignUpPanel = lazy(() => import('pl-fe/features/ui/components/panels/sign-up-panel')); -export const TrendsPanel = lazy(() => import('pl-fe/features/ui/components/panels/trends-panel')); -export const UserPanel = lazy(() => import('pl-fe/features/ui/components/panels/user-panel')); -export const WhoToFollowPanel = lazy(() => import('pl-fe/features/ui/components/panels/who-to-follow-panel')); +export const AccountNotePanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/panels/account-note-panel')); +export const AnnouncementsPanel = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/components/announcements/announcements-panel')); +export const BirthdayPanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/components/birthday-panel')); +export const CryptoDonatePanel = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/crypto-donate/components/crypto-donate-panel')); +export const GroupMediaPanel = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/ui/components/panels/group-media-panel')); +export const InstanceInfoPanel = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/panels/instance-info-panel')); +export const InstanceModerationPanel = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/ui/components/panels/instance-moderation-panel')); +export const LatestAccountsPanel = lazy(() => import(/* webpackChunkName: "admin" */ 'pl-fe/features/admin/components/latest-accounts-panel')); +export const MyGroupsPanel = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/ui/components/panels/my-groups-panel')); +export const NewEventPanel = lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/ui/components/panels/new-event-panel')); +export const NewGroupPanel = lazy(() => import(/* webpackChunkName: "groups" */ 'pl-fe/features/ui/components/panels/new-group-panel')); +export const PinnedAccountsPanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/panels/pinned-accounts-panel')); +export const ProfileFieldsPanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/panels/profile-fields-panel')); +export const ProfileInfoPanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/panels/profile-info-panel')); +export const ProfileMediaPanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/panels/profile-media-panel')); +export const PromoPanel = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/panels/promo-panel')); +export const SignUpPanel = lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/ui/components/panels/sign-up-panel')); +export const TrendsPanel = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/panels/trends-panel')); +export const UserPanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/panels/user-panel')); +export const WhoToFollowPanel = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/features/ui/components/panels/who-to-follow-panel')); -export const Audio = lazy(() => import('pl-fe/features/audio')); -export const ChatWidget = lazy(() => import('pl-fe/features/chats/components/chat-widget/chat-widget')); +export const Audio = lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/audio')); +export const ChatWidget = lazy(() => import(/* webpackChunkName: "chats" */ 'pl-fe/features/chats/components/chat-widget/chat-widget')); export const CryptoAddress = lazy(() => import('pl-fe/features/crypto-donate/components/crypto-address')); export const DatePicker = lazy(() => import('pl-fe/features/birthdays/date-picker')); export const EmojiPicker = lazy(() => import('pl-fe/features/emoji/components/emoji-picker')); -export const EventHeader = lazy(() => import('pl-fe/features/event/components/event-header')); +export const EventHeader = lazy(() => import(/* webpackChunkName: "events" */ 'pl-fe/features/event/components/event-header')); export const LightningAddress = lazy(() => import('pl-fe/features/crypto-donate/components/lightning-address')); -export const MfaForm = lazy(() => import('pl-fe/features/security/mfa-form')); -export const ModalRoot = lazy(() => import('pl-fe/features/ui/components/modal-root')); -export const OnboardingWizard = lazy(() => import('pl-fe/features/onboarding/onboarding-wizard')); -export const ProfileHoverCard = lazy(() => import('pl-fe/components/profile-hover-card')); -export const SidebarMenu = lazy(() => import('pl-fe/components/sidebar-menu')); -export const StatusHoverCard = lazy(() => import('pl-fe/components/status-hover-card')); -export const Video = lazy(() => import('pl-fe/features/video')); +export const MfaForm = lazy(() => import(/* webpackChunkName: "auth" */ 'pl-fe/features/security/mfa-form')); +export const ModalRoot = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui/components/modal-root')); +export const OnboardingWizard = lazy(() => import(/* webpackChunkName: "onboarding" */ 'pl-fe/features/onboarding/onboarding-wizard')); +export const ProfileHoverCard = lazy(() => import(/* webpackChunkName: "accounts" */ 'pl-fe/components/profile-hover-card')); +export const SidebarMenu = lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/components/sidebar-menu')); +export const StatusHoverCard = lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/components/status-hover-card')); +export const Video = lazy(() => import/* webpackChunkName: "statuses" */ ('pl-fe/features/video')); diff --git a/packages/pl-fe/src/init/pl-fe-mount.tsx b/packages/pl-fe/src/init/pl-fe-mount.tsx index d6a5bf00d..920c061d7 100644 --- a/packages/pl-fe/src/init/pl-fe-mount.tsx +++ b/packages/pl-fe/src/init/pl-fe-mount.tsx @@ -17,9 +17,9 @@ import { } from 'pl-fe/hooks'; import { useCachedLocationHandler } from 'pl-fe/utils/redirect'; -const GdprBanner = React.lazy(() => import('pl-fe/components/gdpr-banner')); -const EmbeddedStatus = React.lazy(() => import('pl-fe/features/embedded-status')); -const UI = React.lazy(() => import('pl-fe/features/ui')); +const GdprBanner = React.lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/components/gdpr-banner')); +const EmbeddedStatus = React.lazy(() => import(/* webpackChunkName: "statuses" */ 'pl-fe/features/embedded-status')); +const UI = React.lazy(() => import(/* webpackChunkName: "ui" */ 'pl-fe/features/ui')); /** Highest level node with the Redux store. */ const PlFeMount = () => { diff --git a/packages/pl-fe/vite.config.ts b/packages/pl-fe/vite.config.ts index b3d5f8574..e518004d1 100644 --- a/packages/pl-fe/vite.config.ts +++ b/packages/pl-fe/vite.config.ts @@ -11,6 +11,7 @@ import { createHtmlPlugin } from 'vite-plugin-html'; import { VitePWA } from 'vite-plugin-pwa'; import vitePluginRequire from 'vite-plugin-require'; import { viteStaticCopy } from 'vite-plugin-static-copy'; +import { manualChunksPlugin } from 'vite-plugin-webpackchunkname'; const config = defineConfig(({ command }) => ({ build: { @@ -30,6 +31,7 @@ const config = defineConfig(({ command }) => ({ port: Number(process.env.PORT ?? 3036), }, plugins: [ + manualChunksPlugin(), checker({ typescript: true }), // @ts-ignore vitePluginRequire.default(), diff --git a/packages/pl-fe/yarn.lock b/packages/pl-fe/yarn.lock index 988329622..fa9dde251 100644 --- a/packages/pl-fe/yarn.lock +++ b/packages/pl-fe/yarn.lock @@ -1745,6 +1745,11 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== +"@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": version "0.3.19" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" @@ -2209,6 +2214,13 @@ resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.18.0.tgz#20b033d1f542a100c1d57cfd18ecf442d1784732" integrity sha512-L3jkqmqoSVBVKHfpGZmLrex0lxR5SucGA0sUfFzGctehw+S/ggL9L/0NnC5mw6P8HUWpFZ3nQw3cRApjjWx9Sw== +"@rollup/plugin-alias@*": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-5.1.0.tgz#99a94accc4ff9a3483be5baeedd5d7da3b597e93" + integrity sha512-lpA3RZ9PdIG7qqhEfv79tBffNaoDuukFDrmhLqg9ifv99u/ehn+lOg30x2zmhf8AQqQUZaMk/B9fZraQ6/acDQ== + dependencies: + slash "^4.0.0" + "@rollup/plugin-babel@^5.2.0": version "5.3.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz#04bc0608f4aa4b2e4b1aebf284344d0f68fda283" @@ -2237,6 +2249,15 @@ "@rollup/pluginutils" "^3.1.0" magic-string "^0.25.7" +"@rollup/pluginutils@*": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" + integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" @@ -5016,6 +5037,11 @@ es-iterator-helpers@^1.0.17: iterator.prototype "^1.1.2" safe-array-concat "^1.1.2" +es-module-lexer@*: + version "1.5.4" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" + integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== + es-module-lexer@^1.2.1: version "1.3.1" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.3.1.tgz#c1b0dd5ada807a3b3155315911f364dc4e909db1" @@ -5653,7 +5679,7 @@ estree-walker@^1.0.1: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== -estree-walker@^2.0.1: +estree-walker@^2.0.1, estree-walker@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== @@ -7445,6 +7471,13 @@ lz-string@^1.5.0: resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941" integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ== +magic-string@*: + version "0.30.11" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.11.tgz#301a6f93b3e8c2cb13ac1a7a673492c0dfd12954" + integrity sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A== + dependencies: + "@jridgewell/sourcemap-codec" "^1.5.0" + magic-string@^0.25.0, magic-string@^0.25.7: version "0.25.9" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" @@ -9800,6 +9833,11 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== +slash@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" + integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== + slice-ansi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" @@ -10961,6 +10999,16 @@ vite-plugin-static-copy@^1.0.0: fs-extra "^11.1.0" picocolors "^1.0.0" +vite-plugin-webpackchunkname@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/vite-plugin-webpackchunkname/-/vite-plugin-webpackchunkname-1.0.3.tgz#ad0cd3f2a1ab9790ffc80eb5e1cb6b6e5171c66b" + integrity sha512-88lt6IrgCumnf4Up8eyaSJbmo4V0ZIaR4M94fbZvGGmK2aWMmPGVsiFBszYE7Kq04I9tGjLFnyremn+KEgEGyw== + dependencies: + "@rollup/plugin-alias" "*" + "@rollup/pluginutils" "*" + es-module-lexer "*" + magic-string "*" + vite@^5.0.0, vite@^5.0.10: version "5.0.10" resolved "https://registry.yarnpkg.com/vite/-/vite-5.0.10.tgz#1e13ef5c3cf5aa4eed81f5df6d107b3c3f1f6356"