External JS file in Angular 18

Discussão em 'Angular' iniciado por Meysam Hit, Janeiro 5, 2025.

  1. Meysam Hit

    Meysam Hit Guest

    When using a Leaflet plugin in Angular 18, everything works fine during development (serve time). However, after building the project, the JS file doesn't load, causing an error.

    For example, with Leaflet.EasyButton this error happened:


    C.easyButton is not a function
    ​

    I tried adding the JS file to angular.json, including it in allowedCommonJsDependencies, and disabling optimization, but none of these solutions worked.

    It seems the JS file is not loaded in the correct order in the built files.

    Continue reading...

Compartilhe esta Página