Is there a way I can get this package to work with Angular 16

Discussão em 'Angular' iniciado por MadMac, Janeiro 21, 2025.

  1. MadMac

    MadMac Guest

    I have used the package https://www.npmjs.com/package/ngx-hotjar v11.0.0 successfully on an Angular 10 project. I have created a new Angular 16 project and I get the error below when running ng serve:

    Error: src/app/app.module.ts:275:12 - error NG6002: 'NgxHotjarModule' does not appear to be an NgModule class.

    275 imports: [
    ~
    276 BrowserModule,
    ~~~~~~~~~~~~~~~~~~
    ...
    341 // SweetAlert2Module.forRoot()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    342 ],
    ~~~
    node_modules/ngx-hotjar/lib/ngx-hotjar.module.d.ts:22:22
    22 export declare class NgxHotjarModule {
    ~~~~~~~~~~~~~~~
    This likely means that the library (ngx-hotjar) which declares NgxHotjarModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
    Error: src/app/app.module.ts:337:5 - error NG6002: 'NgxHotjarRouterModule' does not appear to be an NgModule class.

    337 NgxHotjarRouterModule,
    ~~~~~~~~~~~~~~~~~~~~~

    node_modules/ngx-hotjar/lib/ngx-hotjar-router/ngx-hotjar-router.module.d.ts:29:22
    29 export declare class NgxHotjarRouterModule {
    ~~~~~~~~~~~~~~~~~~~~~
    This likely means that the library (ngx-hotjar) which declares NgxHotjarRouterModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.


    To Reproduce

    Create a new Angular 16 project

    npm i ngx-hotjar

    **app.module.ts:**
    import { NgxHotjarModule, NgxHotjarRouterModule } from 'ngx-hotjar';
    imports: [ ... NgxHotjarModule.forRoot(environment.hj.trackingCode),
    NgxHotjarRouterModule]


    [​IMG]

    Continue reading...

Compartilhe esta Página