jonagh / gapi-querier

Tool for running Google APIs, and to play with google auth and stuff.
GNU General Public License v3.0
102 stars 35 forks source link

Under Firefox 65.0: SyntaxError: dynamic module import is not implemented commands.js:3:44 #1

Closed bgoodr closed 5 years ago

bgoodr commented 5 years ago

Hi,

I'm the original poster of the SE question: https://webapps.stackexchange.com/questions/82693/how-can-i-view-google-photos-that-are-not-in-a-google-photos-album and saw your answer at https://webapps.stackexchange.com/a/125617/14529

Encouraged, I wanted to give it a spin. So, I forked your gapi-querier repo, made no changes to it in my fork, and followed the directions to the letter. I am now able to see the website at https://bgoodr.github.io/gapi-querier/.

Copying/pasting my Client ID into that field and hitting enter did not show anything. So I opened up Web Developer/Console (I'm using Firefox version 65.0) and saw:

SyntaxError: dynamic module import is not implemented commands.js:3:44

I cleared the web console output, and reloaded the page, and the above error reproduced. So, it is not due to OAUTH authorization yet, but due to javascript syntax.

I retried it under Google Chrome (Version 72.0.3626.109 (Official Build) (64-bit)), and it worked (I did have to force it to authorize as for some reason my app was not authorized). So something is not being adequately supported in Firefox 65 I think, or maybe Google Chrome is a bit lax?

Looking at the code I do see an import statement at https://github.com/jonagh/gapi-querier/blob/master/commands.js#L3

So I searched for that error on the web, I found https://stackoverflow.com/a/46415925/257924 which leads me further to to believe that the syntax there might still be not treated identically between Firefox and Chrome. I did notice that you do have a directive to declare “main.js” as a module at https://github.com/jonagh/gapi-querier/blob/master/index.html#L47 , but maybe Firefox insists that you also declare “commands.js” as a module too?

I really would love to see this working under Firefox. I don’t use Chrome, and it would be painful for me to switch to it.

Thanks, bgoodr

jonagh commented 5 years ago

Yup you're right.. Firefox doesn't support dynamic imports yet (it is currently behind a flag). I didn't really consider cross-browser support - I should have, I guess, but I was just hacking it together for my own purposes.

I have now changed the dynamic imports (in commands.js) to static imports (16ee5bf5396536a78cf9ed15b554fd8b439b6fe9). I tested in the latest version of Firefox and it seems to work now :)

Let me know if it works out.

bgoodr commented 5 years ago

Thanks for the fix. I've pulled in and verified that now I'm able to start the run. However, I do not see any output, but that is a separate issue which I will file (probably user error on my part).