diff --git a/package-lock.json b/package-lock.json
index 9bf2165..924a031 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4,6 +4,9 @@
"requires": true,
"packages": {
"": {
+ "dependencies": {
+ "leaflet": "^1.9.4"
+ },
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/vite": "^4.0.0",
@@ -2276,6 +2279,12 @@
"vite": "^7.0.0"
}
},
+ "node_modules/leaflet": {
+ "version": "1.9.4",
+ "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
+ "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
+ "license": "BSD-2-Clause"
+ },
"node_modules/lightningcss": {
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",
diff --git a/package.json b/package.json
index 2ea7e1d..dbffe1a 100644
--- a/package.json
+++ b/package.json
@@ -17,5 +17,8 @@
"postcss": "^8.4.31",
"tailwindcss": "^3.1.0",
"vite": "^7.0.7"
+ },
+ "dependencies": {
+ "leaflet": "^1.9.4"
}
}
diff --git a/resources/js/carte.js b/resources/js/carte.js
new file mode 100644
index 0000000..d867619
--- /dev/null
+++ b/resources/js/carte.js
@@ -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;
diff --git a/resources/views/carte/index.blade.php b/resources/views/carte/index.blade.php
index db2dd6e..02334da 100644
--- a/resources/views/carte/index.blade.php
+++ b/resources/views/carte/index.blade.php
@@ -7,9 +7,8 @@
@push('head')
- {{-- Leaflet CSS --}}
-
+ {{-- Leaflet (bundlé via Vite) --}}
+ @vite('resources/js/carte.js')