amcharts / export

Apache License 2.0
56 stars 33 forks source link

Fixing issue with AmCharts filename error #79

Closed pablohpsilva closed 6 years ago

pablohpsilva commented 6 years ago

I'm build an app that wraps AmChart on a web component and export it on webpack. OK, I know AmChart was not meant to be used with webpack. Pretty much everything worked fine, except for this nasty error on console:

export.js?1994:3080 Uncaught ReferenceError: filename is not defined
    at Object.handleReady (export.js?1994:3080)
    at eval (export.js?1994:4216)
handleReady @ export.js?1994:3080
(anonymous) @ export.js?1994:4216
setInterval (async)
init @ export.js?1994:4197
construct @ export.js?1994:4340
AmCharts.export @ export.js?1994:4363
(anonymous) @ export.js?1994:4374
d.callInitHandler @ amcharts.js?7355:8
initChart @ amcharts.js?7355:115
initChart @ amcharts.js?7355:291
initChart @ [...obfuscated].min.js?0983:2025
initChart @ [...obfuscated].min.js?0983:2258
afterWrite @ amcharts.js?7355:115
write @ amcharts.js?7355:111
(anonymous) @ amcharts.js?7355:11
d.handleLoad @ amcharts.js?7355:7
localhost/:1 GET http://localhost:8080/__webpack_hmr net::ERR_INCOMPLETE_CHUNKED_ENCODING

In order to fix it, All I had to do was remove the forIn and replace it with a Object.keys. Everything is working fine now.

pablohpsilva commented 6 years ago

Probably it would @xorspark :) I can do it later (I'm still on working hours LOL)

xorspark commented 6 years ago

No problem @pablohpsilva. Let us know when you get a chance. Since we don't really support webpack with the export plugin at the moment, we'd rather not merge a fix for it without at least that confirmation. We can at least test the regular script tag use case once you're set. Thanks!

pablohpsilva commented 6 years ago

@xorspark did it. It is ready for you guys :)

xorspark commented 6 years ago

Thanks @pablohpsilva! I'm not seeing any regressions with the script tag use case on my end. I'll inform the team to get this merged.

maertz commented 6 years ago

Pushed an update: https://github.com/amcharts/export/commit/09ba8422ebbea8f1c4eee5061cbcff307976a62d, Thanks for your help.