<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi LRUGers,</p>
<p>So here's a tricky issue that might be of interest and I could
use help with :-)</p>
<p>I've got the lovely topojson library working for me in a Rails
app locally:<br>
<br>
<a href="https://github.com/topojson/topojson">https://github.com/topojson/topojson</a></p>
<p>and it's allowing us to show some nice geoJSON in a google map
like so:</p>
<p><img src="cid:part2.748BA9F5.006832F0@gmail.com" alt=""></p>
<p>I show it with the map.js file exposed, since that seems to be
where the trouble is when we deploy to heroku. On heroku the
map.js file gives an error on chrome:<br>
<br>
> maps-....js:27 Uncaught SyntaxError: Unexpected token export</p>
<p>and a similar error (although on a different line) on firefox:<br>
<br>
> <span class="message-body-wrapper"><span
class="message-flex-body"><span class="message-body
devtools-monospace">SyntaxError: export declarations may
only appear at top level of a module maps-...js:1</span></span></span></p>
<p><span class="message-body-wrapper"><span
class="message-flex-body"><span class="message-body
devtools-monospace"></span><span class="message-location
devtools-monospace"><span
data-url="https://kcsc.herokuapp.com/assets/maps-f5cd362bb136069cb709fa43918fa4d9f595d642d3533664e8046dc5778e3bf8.js"
class="frame-link" data-line="1"><a
href="https://kcsc.herokuapp.com/assets/maps-f5cd362bb136069cb709fa43918fa4d9f595d642d3533664e8046dc5778e3bf8.js"
class="frame-link-source" draggable="false"><span
class="frame-link-source-inner" title="View source in
Debugger →
https://kcsc.herokuapp.com/assets/maps-f5cd362bb136069cb709fa43918fa4d9f595d642d3533664e8046dc5778e3bf8.js:1"><span
class="frame-link-line"><img
src="cid:part3.1E3006D4.6BB45D78@gmail.com" alt=""></span></span></a><br>
</span></span></span></span></p>
<p>I've been in touch with heroku support who suggested locking down
our npm version, as it seems like the minified js file is ending
up with slightly different content locally than on heroku. I note
that I've done everything I can to replicate production mode
locally, clobbering and recompiling the static assets etc. and
running like so:<br>
<br>
```<br>
RAILS_SERVE_STATIC_FILES=true DEVISE_SECRET_KEY=1234
AIRBRAKE_PROJECT_ID=1234 RAILS_ENV=production be rails s<br>
```</p>
<p>but I cannot replicate the issue on my dev machine.</p>
<p>You can see all the gory details in this PR <a
href="https://github.com/AgileVentures/LocalSupport/pull/1069">https://github.com/AgileVentures/LocalSupport/pull/1069</a>
and I was wondering if anyone had any ideas about anything else
that could be a difference between my dev machine and heroku that
could be leading to the javascript files compiling differently?
On heroku we have the following:<br>
<br>
```<br>
export*from"topojson-client";export*from"topojson-server";export*from"topojson-simplify<br>
```<br>
</p>
<p>but there is no mention of the offending `export` keywords in the
static assets compiled locally, but there they are in the files on
the heroku server. I've been trying all sort of methods to
ensure that I'm deleting cached files and that that the changes I
am making are being reflected both locally and on heroku.</p>
<p>I've also been investigating ways to try and handle the export
keyword (new in es6) but that seems like an even deeper rabbit
hole, i.e. sprockets 4 or webpack or similar.</p>
<p>Anyhow, if anyone has any thoughts on other things that could
cause heroku to be operating differently here I'd love to hear
them, so I can either lock them down or work out how to replicate
the bug locally.</p>
<p>Many thanks in advance</p>
<p>Best, Sam<br>
</p>
</body>
</html>