neveldo / jQuery-Mapael

jQuery plugin based on raphael.js that allows you to display dynamic vector maps
https://www.vincentbroute.fr/mapael/
MIT License
1.01k stars 195 forks source link

Error: Unknown map 'world_countries' with React #362

Closed luanfonceca closed 6 years ago

luanfonceca commented 6 years ago

Description

I am using the Mapael with React. I have just installed the package using yarn and started to setup the "Minimal example". But i am getting an error "Unknown map 'world_countries'", I added a debugger on jquery-mapael/js/jquery-mapael.js like 146 and print the variables and founded out that the maps property from mapael plugin are not loaded.

# jquery-mapael/js/jquery-mapael.js+146

console.log(pluginName)
mapael

console.log($[pluginName].maps)
undefined

console.log(self.options.map.name)
"world_countries"

Environment

luanfonceca commented 6 years ago

I found what was wrong in my code.

I have imported only the jquery and jquery-mapeael, but i need to import the maps that i want to use too.

import $ from 'jquery';
import 'jquery-mapael';
import 'jquery-mapael/js/maps/world_countries.js';
neveldo commented 6 years ago

Hi @luanfonceca ,

Great, I'm glad you solved your issue !

luanfonceca commented 6 years ago

I thought that i just needed to import the mapael package and the maps on Examples page would be automatically imported too, but looking at the example html i saw that you need to import it too.