xsrf / easyeda-svg-import

Simple SVG Importer for EasyEDA PCB that doesn't convert everything to Comic Sans 😄
85 stars 8 forks source link

Syntax Error: Unexpected token import. #16

Closed pastprimitive closed 3 years ago

pastprimitive commented 3 years ago

Tried installing the extension for the OS X desktop client of EasyEDA. It throws "Syntax Error: Unexpected token import" when I try to install the extension in EasyEDA's Extension menu. Throws the error for both versions 1.7 and 1.6 but 1.5 seems to work fine.

xsrf commented 3 years ago

Since I don't have any apple device it is hard for me to test... What EasyEDA Version is running in the Desktop Client? Have you updated to the latest version available? Hit "Help" - "About" in EasyEDA to get the Version. Also please right click in EasyEDA somewhere (not in the editor) and hit "Developer Tool". Then go to the "Console" panel and type navigator.userAgent and hit enter. Please copy the userAgent string you get.

Also, have you tested it in the Browser? Does it work there?

turbobabr commented 3 years ago

FIY, just checked the extension on my macOS Mojave 10.14.6 using the latest version of desktop client - it works without any issues. May be it is some sort of subtle issue introduced by certain OS/Client versions?

xsrf commented 3 years ago

@turbobabr thx for the test, what's the user agent of the browser in your client? I'm not sure, but the bundled browser may use components supplied by the OS.

@pastprimitive also, can you post a screenshot? Is the error shown in an alert box that EasyEDA generates within the UI, or is it shown in the developer console? Do you get the error right after you selected and opened all files for the install, or after you hit the Load Extension button? Is the extension id field filled with svgimport correctly after the files were selected?

turbobabr commented 3 years ago

@xsrf In my case it is listed as follows:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) EasyEDA/6.4.19.4 Chrome/78.0.3904.130 Electron/7.1.14 Safari/537.36 EasyEDA-Editor/6.4.19.4 (Halfline Mode)

In reality, every OS variation should get the same Chromium browser, since the EasyEDA client app is just a web site wrapped in ElectronJS shell. 🤔

The only code that is capable of producing such exception is this line in your auto update utils: https://github.com/xsrf/easyeda-svg-import/blob/master/extension/easyeda-helper.js#L21

According to the code - that function isn't called at all but somehow manages to throw the error.

xsrf commented 3 years ago

@turbobabr thx... I was wondering if it's this function because it's the only import keyword... but as you said, it never gets called. I just played around with dynamically loading JS modules from files that are installed along with the extension. But it's not used there... Also, import isn't that new 🤔https://caniuse.com/?search=import

turbobabr commented 3 years ago

@xsrf Mystery... 🙃

xsrf commented 3 years ago

@pastprimitive to be on the safe side, this is version 1.7 with the import statement removed - does it install fine?

extension_1.7_no_import.zip

If it does, please go to the About dialog of the SVG Import Extension in the PCB Editor and copy the Browser-Info shown there.

xsrf commented 3 years ago

@pastprimitive since I got no response and I have no idea how this error can even happen, I'll close this issue for now. Feel free to reopen / comment when you have had time to test the fix.