0

I am testing a 'ng-circle-progress' in my existing angular library where the NgCircleProgressModule has only .forRoot() method as initialization.

But it throws error while creating a build using below cmd.

ng build shared-lib --prod 

// Module.ts

import { ModuleWithProviders, NgModule } from '@angular/core';
import { MessageService } from 'primeng/api';
import { NotificationComponent } from './components/notification/notification.component';
import { CommonModule } from '@angular/common';
import { TableModule } from 'primeng/table';
import { ConfirmationDialogComponent } from './components/confirmation-dialog/confirmation-dialog.component';
import { DialogService } from 'primeng/dynamicdialog';
import { NodatafoundComponent } from './components/nodatafound/nodatafound.component';
import { PasswordStrengthComponent } from './components/password-strength/password-strength.component';
import { SafeHtmlPipe } from './pipes/safe-html.pipe';
import { DashComponentSettingsComponent } from './components/dashboard/dash-component-settings/dash-component-settings.component';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { reducers } from './_store/lib.reducer';
import { LibEffects } from './_store/lib.effects';
import { AccordionModule } from 'primeng/accordion';
import { AuthComponent } from './components/auth.component';
import { FullCalendarModule } from '@fullcalendar/angular'; // must go before plugins
import { AddCreatedWidgetsDialogComponent } from './components/dashboard/add-created-widgets-dialog/add-created-widgets-dialog.component';
import { TabViewModule } from 'primeng/tabview';
import { NgCircleProgressModule } from "ng-circle-progress";

const ExportsComp = [
  AuthComponent,
  NotificationComponent,
  ConfirmationDialogComponent,
  NodatafoundComponent,
  PasswordStrengthComponent,
  SafeHtmlPipe,
  ......
]

const ExportModule = [
  FullCalendarModule,
  AccordionModule,
  TableModule,
  ....
]


export const customStoreModule = StoreModule.forFeature("library", reducers);
export const customEffectsModule = EffectsModule.forFeature([LibEffects]);
 // Specify ng-circle-progress as an import
export const CircleProgressModule = NgCircleProgressModule.forRoot();

@NgModule({
  declarations: [
    ExportsComp,
    DashComponentSettingsComponent,
    AddCreatedWidgetsDialogComponent
  ],
  imports: [
    CommonModule,
    customStoreModule,
    TabViewModule,
    customEffectsModule,
    ExportModule,
    CircleProgressModule
  ],
  exports: [
    ExportsComp,
    ExportModule
  ]
})

export class SharedLibModule {
  public static forRoot(environment?: any): ModuleWithProviders<SharedLibModule> {

    return {
      ngModule: SharedLibModule,
      providers: [
        {
          provide: 'environment',
          useValue: environment
        },
        MessageService,
        DialogService,
        ......
      ]
    };
  }
}

// Error while compiling enter image description here

// Application versions

    "@angular-devkit/build-angular": "~0.1100.3",
    "@angular/cli": "~11.0.3",
    "@angular/compiler-cli": "~11.0.3",
    "@types/google.maps": "^3.45.2",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.20.15",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.1.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "ng-packagr": "^11.0.0",
    "protractor": "~7.0.0",
    "sonar-scanner": "^3.1.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2"

Tried below solutions but didn't worked for me. https://stackoverflow.com/a/61737945 https://stackoverflow.com/a/63864396

Any help would be appreciated :)

Ankesh Pandey
  • 137
  • 1
  • 15

0 Answers0