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.
import JS file:
import 'public/js/easy-button.js';
It seems the JS file is not loaded in the correct order in the built files.
architect-->build-->options-->scriptsorimport * as Easy from 'public/js/easy-button.js';