angularleafletleaflet.drawngx-leafletngx-leaflet-draw

ngx-leaflet-draw: Importing module which does not have a ɵmod property


Importing LeafletDrawModule which does not have a ɵmod property

I am seeing this error during my unit testing(jest).

The code works fine when I run the ng application. Leaflet draw function works perfectly.

Angular: 11
@asymmetrik/ngx-leaflet: 8.1.0
@asymmetrik/ngx-leaflet-draw: 7.0.0

This error happens when unit testing components referencing LeafletDrawModule


Solution

  • Finally found the solution.

    After running ngcc on the module folder the issue resolved itself.

    Incase you get ngcc' is not recognized as an internal or external command you haven't configured the nodemodule binary path in PATH. You can get execute it from [project_path]\node_modules\.bin\ngcc

    or

    If you have the postinstall configured in package.json,

    "scripts": {
       .
       "postinstall": "ngcc",
       .
    }
    

    run npm run postintall.