Leaflet Maps not properly rendering
eakenbor opened this issue · comments
eakenbor commented
Contact Details
No response
What happened?
My leaflet map is rendering scattered as shown in the attached image.
See my code below.
import leafletFeatures from '@adminjs/leaflet';
import Booking from '../../models/booking.js'
import { componentLoader, Components } from '../components/components.js'
const BookingResource = {
resource: Booking,
options: {
properties: {
createdAt: { isVisible: { edit: false, show: true, list: true, filter: true } },
updatedAt: { isVisible: { edit: false, show: true, list: true, filter: true } },
vehicle: {
components: {
edit: Components.EditInput,
},
},
'activities.name': {
components: {
edit: Components.EditInput,
},
}
},
},
features: [
leafletFeatures.leafletSingleMarkerMapFeature({
componentLoader,
paths: {
jsonProperty: undefined,
latitudeProperty: 'locationLat',
longitudeProperty: 'locationLng',
},
baseValue: undefined,
mapProps: undefined,
tileProps: undefined,
}),
],
}
export default BookingResource
Also, when I tried to use app.use(express.static(getLeafletDist()));
in my server.js, I get the following error:
Uncaught Exception: ReferenceError: require is not defined
at getLeafletDist (file:///C:/Users/efosa/Desktop/SendMechanic/server/node_modules/@adminjs/leaflet/lib/utils/get-leaflet-dist.js:2:40)
Please can anyone help me with this?
Bug prevalence
Every time
AdminJS dependencies version
"@adminjs/express": "^6.0.0",
"@adminjs/leaflet": "^2.0.0",
"@adminjs/mongoose": "^4.0.0",
"@adminjs/themes": "^1.0.0",
"adminjs": "^7.0.5",
What browsers do you see the problem on?
Chrome
Relevant log output
No response
Relevant code that's giving you issues
No response
Rafał Dzięgielewski commented
Looks like the ESM update in @adminjs/leaflet
was broken/unfinished. I've fixed this just now in 2.0.1:
https://github.com/SoftwareBrothers/adminjs-leaflet/releases/tag/v2.0.1