title: R Highcharter - how to load a custom map with a local file
body: <p>I was loading a custom map (<code>hcmap(map =&quot;custom/world-highres2.js&quot;)</code>
  ) as usual last month but ran into <code>Error: parse error: trailing garbage</code>. See this <a href="https://stackoverflow.com/questions/70308459/r-highcharter-map-error-parse-error-trailing-garbage">post</a>. There is no definite fix, but the development version worked. It makes me wonder if loading the custom map locally would avoid the issue. I followed the answer to this <a href="https://stackoverflow.com/questions/54727132/hcmap-with-a-local-file-javascript-in-r-shiny">post</a>, but it returned blank. Here is what I did:</p>
  <pre><code>library(highcharter)
  my_map &lt;- hcmap(&quot;custom&quot;) # I also tried my_map &lt;- hcmap(&quot;custom/word&quot;), hcmap(&quot;custom/word-highres2&quot;) and hcmap(&quot;custom/word-highres2.js&quot;)
  saveRDS(my_map, &quot;my_map.RDS&quot;)
  trace(hcmap, edit=T) # Set mapdata &lt;- readRDS(&quot;my_map.RDS&quot;)
  hcmap(map =&quot;custom/world-highres2.js&quot;) # Returned blank map.
  </code></pre>