Carte : remplace Leaflet CDN par bundle Vite local

Le CDN unpkg.com échoue si le serveur n'a pas accès à Internet.
- npm install leaflet
- resources/js/carte.js : point d'entrée qui importe Leaflet + expose window.LeafletMap
- vite.config.js : ajoute carte.js aux inputs compilés
- carte/index.blade.php : @vite au lieu du CDN, utilise window.LeafletMap

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 19:45:12 +02:00
parent fdd81977c2
commit e29824b575
5 changed files with 34 additions and 9 deletions
+16
View File
@@ -0,0 +1,16 @@
import L from 'leaflet';
import 'leaflet/dist/leaflet.css';
// Correction des icônes Leaflet avec Vite (les chemins par défaut ne fonctionnent pas avec bundler)
import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png';
import markerIcon from 'leaflet/dist/images/marker-icon.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: markerIcon2x,
iconUrl: markerIcon,
shadowUrl: markerShadow,
});
window.LeafletMap = L;