Skip to content

Commit

Permalink
Merge pull request #35631 from dimagi/jls/ucr-maps
Browse files Browse the repository at this point in the history
Added logic to reset leaflet images
  • Loading branch information
orangejenny authored Jan 18, 2025
2 parents 40e09ec + 20aedd7 commit bebe117
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
'underscore',
- 'reports/js/bootstrap3/maps_utils',
+ 'reports/js/bootstrap5/maps_utils',
'leaflet',
], function (
$,
_,
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ hqDefine('reports_core/js/bootstrap3/maps', [
'jquery',
'underscore',
'reports/js/bootstrap3/maps_utils',
'leaflet',
], function (
$,
_,
mapsUtils
mapsUtils,
L
) {
// Reset images needed for map markers, which don't play well with webpack.
// See https://github.com/Leaflet/Leaflet/issues/4968#issuecomment-483402699
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
iconUrl: require('leaflet/dist/images/marker-icon.png'),
shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
});

var module = {},
privates = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ hqDefine('reports_core/js/bootstrap5/maps', [
'jquery',
'underscore',
'reports/js/bootstrap5/maps_utils',
'leaflet',
], function (
$,
_,
mapsUtils
mapsUtils,
L
) {
// Reset images needed for map markers, which don't play well with webpack.
// See https://github.com/Leaflet/Leaflet/issues/4968#issuecomment-483402699
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
iconUrl: require('leaflet/dist/images/marker-icon.png'),
shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
});

var module = {},
privates = {};

Expand Down
4 changes: 4 additions & 0 deletions webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ module.exports = {
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.png/,
type: 'asset/resource',
},

// this rule ensures that hqDefine is renamed to define AMD module
// definition syntax that webpack understands
Expand Down

0 comments on commit bebe117

Please sign in to comment.