You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could not find any information on how to get this plugin working in a https://www.npmjs.com/package/react-leaflet (ie. React or any WebApp) project. I had to perform the following - oh, its a Typescript project also but after playing around with this problem it seems that I don't need to modify the tsConfig.ts, although theoretically the below change will help in the IDE. However despite specifying a directory I could not see a types directory being made nor .d.ts files being generated (such dirs and files already existed before this change). Maybe that is only for local .js files and not ones in node_modules:
// App.tsx
import "./init"; // necessary to have a definition for global
import "leaflet-ajax";
import L, {
...
} from "leaflet";
import {
MapContainer,
...
} from "react-leaflet";
//init.js
window.global ||= window;
I'm not sure if there is a better way to achieve this, although for one thing it would be helpful to have a .d.ts file (eg @types/leaflet-ajax) for when using this with Typescript.
If there is a better way please let us know. If not could you add this information to the readme?
I could not find any information on how to get this plugin working in a https://www.npmjs.com/package/react-leaflet (ie. React or any WebApp) project. I had to perform the following - oh, its a Typescript project also but after playing around with this problem it seems that I don't need to modify the
tsConfig.ts
, although theoretically the below change will help in the IDE. However despite specifying a directory I could not see atypes
directory being made nor.d.ts
files being generated (such dirs and files already existed before this change). Maybe that is only for local.js
files and not ones innode_modules
:I'm not sure if there is a better way to achieve this, although for one thing it would be helpful to have a
.d.ts
file (eg@types/leaflet-ajax
) for when using this with Typescript.If there is a better way please let us know. If not could you add this information to the readme?
Or perhaps I should be posting this issue to the https://github.com/Leaflet/Leaflet project as a general issue with plugins. Thoughts?
The text was updated successfully, but these errors were encountered: