js描画ライブラリの遅延ロードを試みていますLeaflet-Geoman
webpack と次のコードを使用してロードしています
private async loadGeoman () {
await import(/* webpackChunkName: "leaflet-geoman" */ '@geoman-io/leaflet-geoman-free')
}
そして、それを次の関数で使用します
public async enableDrawing (type: TaggedType, item: any) {
await this.loadGeoman()
this._map.pm.enableDraw(type, {
...
})
....
次のエラーが発生し続けます
TypeError: Cannot read properties of undefined (reading 'enableDraw')
at DrawingService.enableDrawing (drawing.service.ts?af11:192)
at eval (drawing.service.ts?af11:75)
図書館がリーフレットマップに接続していないようです。ライブラリが読み込まれる前にリーフレット マップが作成され、それが問題だと思いますが、それを回避する方法がわかりません