I recently integrated leaflet.js into my Angular 4.1.1 app to show maps and layers successfully. Now, I'm attempting to incorporate a leaflet plugin known as browserPrint
To import Leaflet into a Component, I use the following code:
import * as L from "leaflet";
import * as browserPrint from "../../../../assets/scripts/leaflet.browser.print.min";
The import statement for Leaflet is functioning properly as I can create and display a map.
An issue arises when adding the second line for browserPrint.
During the angular-cli build process, an error is thrown:
ERROR in /src/app/services/driverLists/driver-lists-map/driverLists.map.component.ts (8,31): File '/src/assets/scripts/leaflet.browser.print.min.js' is not a module.
Steps taken to troubleshoot so far:
- I included declare var browserPrint: any; in typings.d.ts
Attempted switching the import to:
import "../../../../assets/scripts/leaflet.browser.print.min";
This resulted in multiple errors and caused issues with the maps
Tried changing the import to:
import * as BrowserPrint from "../../../../assets/scripts/leaflet.browser.print";
Resulting in the error Cannot find module leaflet.browser.print
Also tried adjusting file paths to utilize files from the leaflet.browser.print node modules folder, but encountered the same errors.
QUERY
Seeking assistance on how to integrate the leaflet browser print plugin with a leaflet map within an Angular 4+ application.
Thank you in advance.