tnicola / ngx-joyride

Angular Joyride/Tour library
https://tnicola.github.io/ngx-joyride/
MIT License
245 stars 94 forks source link

"Function calls are not supported, but 'Joyride Module' was called" error when trying to run in a Jenkins pipeline #831

Open cristiancajiaos opened 11 months ago

cristiancajiaos commented 11 months ago

I am trying to use the package in a lazy loaded feature module of an Angular 8 project. When I proceed to run the project with:

node --max_old_space_size=12192 ./node_modules/@angular/cli/bin/ng build --prod

The project is build without errors, and even I tried it with the package working well.

However, the project deploys run through a Jenkins pipeline. The Angular project fails the deploy through Jenkins giving the following error:

ERROR in Error during template compile of 'AppModule'
  Function calls are not supported in decorators but 'JoyrideModule' was called.

This is the content of the app.module.ts

import {APP_INITIALIZER, NgModule} from '@angular/core';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {AppRoutingModule} from './app-routing.module';
import {SharedModule} from './shared/shared.module';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule} from '@angular/common/http';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import { Ng2SmartTableModule } from 'ng2-smart-table';
import {PERFECT_SCROLLBAR_CONFIG, PerfectScrollbarConfigInterface, PerfectScrollbarModule} from 'ngx-perfect-scrollbar';
import {AppComponent} from './app.component';
import {ContentLayoutComponent} from './layouts/content/content-layout.component';
import {FullLayoutComponent} from './layouts/full/full-layout.component';
import {ExpiraSesionComponent} from "./autenticacion/expira-sesion/expira-sesion.component";
import {ReactiveFormsModule} from "@angular/forms";

import {AuthService} from './shared/auth/auth.service';
import {AuthGuard} from './shared/auth/auth-guard.service';
import {DragulaService} from 'ng2-dragula';
import {RemisionModule} from "./pages/remision/remision.module";
import {NgSelectModule} from "@ng-select/ng-select";
import {FormsModule} from "@angular/forms";
// @ts-ignore
import {NgIdleKeepaliveModule} from "@ng-idle/keepalive";
import {DataTablesModule} from "angular-datatables";
import {UiSwitchModule} from "ngx-ui-switch";
import { BlockUI, NgBlockUI, BlockUIModule } from 'ng-block-ui';
import {BandejaModule} from "./pages/bandeja/bandeja.module";
import {HeaderTokenInterceptor} from "./shared/interceptors/header-token-interceptor";
import {NgxFloatButtonModule} from "ngx-float-button";
import {DistribucionModule} from "./pages/distribucion/distribucion.module";
import {BarraLateralUnificadaModule} from "./shared/barra-lateral-unificada/barra-lateral-unificada.module";
import {ToastrModule} from "ngx-toastr";
import {AppInitService} from "./services/app-init.service";
import {TareaModule} from "./pages/tarea/tarea.module";
import {AppInitMensajesService} from "./services/app-init-mensajes.service";
import {RegistroAdministrativoModule} from './pages/registro-administrativo/registro-administrativo.module';
import {JoyrideModule} from "ngx-joyride";

const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
    suppressScrollX: true,
    wheelPropagation: false
};

export function createTranslateLoader(http: HttpClient) {
    return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

export function init_app(appLoadService: AppInitService) {
    return () => appLoadService.init();
}

export function init_app_msj(appLoadService: AppInitService) {
    return () => appLoadService.init();
}

// @ts-ignore
// @ts-ignore
@NgModule({
    declarations: [AppComponent, FullLayoutComponent, ContentLayoutComponent, ExpiraSesionComponent],
    imports: [
        BrowserAnimationsModule,
        AppRoutingModule,
        SharedModule,
        BandejaModule,
        HttpClientModule,
        NgbModule.forRoot(),
        TranslateModule.forRoot({
            loader: {
                provide: TranslateLoader,
                useFactory: createTranslateLoader,
                deps: [HttpClient]
            }
        }),
        PerfectScrollbarModule,
        RemisionModule,
        PerfectScrollbarModule,
        NgSelectModule,
        FormsModule,
        Ng2SmartTableModule,
        NgIdleKeepaliveModule.forRoot(),
        ReactiveFormsModule,
        DataTablesModule,
        UiSwitchModule.forRoot({
            size: 'small',
            color: '#64bd63;',
            checkedTextColor: 'white',
            uncheckedTextColor: '#454545'
        }),
        ReactiveFormsModule,
        BlockUIModule.forRoot(),
    NgxFloatButtonModule,
    DistribucionModule,
    BarraLateralUnificadaModule,
        ToastrModule.forRoot({
            timeOut: 3000,
            extendedTimeOut: 5000,
            progressBar: true,
            closeButton: true,
            positionClass: 'toast-top-right',
            enableHtml: true
        }),
        TareaModule,
        RegistroAdministrativoModule,
        JoyrideModule.forRoot()
    ],
    providers: [
        AuthService,
        AuthGuard,
        DragulaService,
        {
            provide: PERFECT_SCROLLBAR_CONFIG,
            useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
        },
        {provide: PERFECT_SCROLLBAR_CONFIG, useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG},
        {provide: HTTP_INTERCEPTORS, useClass: HeaderTokenInterceptor, multi: true },
        AppInitService,
        {provide: APP_INITIALIZER, useFactory: init_app, deps: [AppInitService], multi: true},
        AppInitMensajesService,
        {provide: APP_INITIALIZER, useFactory: init_app_msj, deps: [AppInitMensajesService], multi: true}

    ],
    exports: [],
    bootstrap: [AppComponent]
})
export class AppModule {
}

Note that there are another modules in the project that use the forRoot() method, but only the JoyrideModule gives the error.

I use v2.2.10 of the package.