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:
@@ -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;
|
||||
Reference in New Issue
Block a user