diff --git a/src/core/features/comments/comments.module.ts b/src/core/features/comments/comments.module.ts index a8b1e754c..7d2c29f13 100644 --- a/src/core/features/comments/comments.module.ts +++ b/src/core/features/comments/comments.module.ts @@ -18,17 +18,26 @@ import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-ro import { CoreCronDelegate } from '@services/cron'; import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CoreCommentsComponentsModule } from './components/components.module'; -import { CoreComments, CoreCommentsProvider } from './services/comments'; -import { CoreCommentsOfflineProvider } from './services/comments-offline'; -import { CoreCommentsSyncProvider } from './services/comments-sync'; +import { CoreComments } from './services/comments'; import { COMMENTS_OFFLINE_SITE_SCHEMA } from './services/database/comments'; import { CoreCommentsSyncCronHandler } from './services/handlers/sync-cron'; -export const CORE_COMMENTS_SERVICES: Type[] = [ - CoreCommentsOfflineProvider, - CoreCommentsSyncProvider, - CoreCommentsProvider, -]; +/** + * Get comments services. + * + * @returns Comments services. + */ +export async function getCommentsServices(): Promise[]> { + const { CoreCommentsOfflineProvider } = await import('@features/comments/services/comments-offline'); + const { CoreCommentsSyncProvider } = await import('@features/comments/services/comments-sync'); + const { CoreCommentsProvider } = await import('@features/comments/services/comments'); + + return [ + CoreCommentsOfflineProvider, + CoreCommentsSyncProvider, + CoreCommentsProvider, + ]; +} const routes: Routes = [ { diff --git a/src/core/features/compile/services/compile.ts b/src/core/features/compile/services/compile.ts index d8c475ae1..f78ed4473 100644 --- a/src/core/features/compile/services/compile.ts +++ b/src/core/features/compile/services/compile.ts @@ -42,7 +42,7 @@ import { makeSingleton } from '@singletons'; // Import core services. import { CORE_SERVICES } from '@/core/core.module'; import { CORE_BLOCK_SERVICES } from '@features/block/block.module'; -import { CORE_COMMENTS_SERVICES } from '@features/comments/comments.module'; +import { getCommentsServices } from '@features/comments/comments.module'; import { CORE_CONTENTLINKS_SERVICES } from '@features/contentlinks/contentlinks.module'; import { CORE_COURSE_SERVICES } from '@features/course/course.module'; import { CORE_COURSES_SERVICES } from '@features/courses/courses.module'; @@ -280,7 +280,6 @@ export class CoreCompileProvider { ...CORE_SERVICES, CoreAutoLogoutService, ...CORE_BLOCK_SERVICES, - ...CORE_COMMENTS_SERVICES, ...CORE_CONTENTLINKS_SERVICES, ...CORE_COURSE_SERVICES, ...CORE_COURSES_SERVICES, @@ -411,8 +410,11 @@ export class CoreCompileProvider { async getLazyLibraries(): Promise[]> { const ADDON_MOD_WORKSHOP_SERVICES = await getWorkshopServices(); + const CORE_COMMENTS_SERVICES = await getCommentsServices(); + return [ ...ADDON_MOD_WORKSHOP_SERVICES, + ...CORE_COMMENTS_SERVICES, ]; }