- Issue created by @ressa
- 🇮🇹Italy itamair
Thanks @ressa for reporting this …
Some questions to better understand how to fix or workaround this:- was aggregation working for you with previous versions (with these libraries not embedded in the module)?;
- does everything work without aggregation with this latest release?
- do you have any clue how to fix or workaround all this? In other words … so you see any clear issue or mistake in latest release commit (that only focuses on this …); - 🇩🇰Denmark ressa Copenhagen
Thanks for a fast reply @itamair. Everything worked well, also with aggregation enabled, and it was right after updating to the new version 10.2.6 I got the problem. I removed the vector-based tile from my map, and now it works well.
It seems like the combination of several javascript files can create an overlap:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors...If you search for the error and aggregation or minify and javascript there are similar issues.
Perhaps this is a Drupal core issue, for the aggregator component → ?
- Status changed to Fixed
12 months ago 3:34pm 24 December 2023 - 🇮🇹Italy itamair
Ho @ressa ... latest commit and new 10.2.7 release should have fixed this issue,
simply excluding the maplibre-gl.js from aggregation.It looks somehow in its aggregation Drupal would assigning into it an already assigned variable, and that conflicts ...
Worth to mention that that both maplibre-gl-js and maplibre-gl-leaflet would only be requested / included in the page load if a "vector" type overlay is defined among the required ones: https://git.drupalcode.org/project/leaflet/-/blob/10.2.x/src/LeafletServ...
Please, reopen this if you still experience the same issue, upon this fix ...
- 🇩🇰Denmark ressa Copenhagen
Perfect @itamair, the latest release which excludes maplibre-gl.js from aggregation fixes the issue.
It's probably a Drupal core issue, since the aggregation combines several javascript files, which causes the problem, so I created 🐛 Aggregation of JavaScript files can cause redeclaration Active .
- 🇩🇰Denmark ressa Copenhagen
To make it easier to replicate for other users, would it be worth adding a tip on how to always load the Maplibre library to the Drupal core Aggregator issue, so that a custom module is not necessary?
Because then Step "#2 Add a layer using the new Maplibre libraries ..." can be replaced with this:
To always load the Maplibre GL library, change this line:
$attached_libraries = ['leaflet/general', 'leaflet/leaflet-drupal'];
To this:
$attached_libraries = ['leaflet/general', 'leaflet/leaflet-drupal', 'leaflet/maplibre-gl-leaflet'];
https://git.drupalcode.org/project/leaflet/-/blob/10.2.x/src/LeafletServ...
- 🇩🇰Denmark ressa Copenhagen
Since a conclusion was found in 🐛 Aggregation of JavaScript files can cause redeclaration Active , I have created a new Aggregate CSS and JS files in Drupal core → page under "Performance", adding a workaround to the JS aggregation problem.
Automatically closed - issue fixed for 2 weeks with no activity.