KNowledgeOnWebScale / solid-authentication-browser-extension

10 stars 1 forks source link

SyntaxError on import #3

Closed axellorreyne closed 1 year ago

axellorreyne commented 1 year ago

In some cases, web-ext return the following error upon running npm start

SyntaxError: import declarations may only appear at top level of a module

I expect this to happen because getToken() is imported and called directly in: https://github.com/KNowledgeOnWebScale/solid-authentication-browser-extension/blob/9552a8529e966b3208a0d112f5f98005cb54989a/popup/popup.js#L16-L19

Instead, it should be a background process that is called as a runtime message

pheyvaer commented 1 year ago

"In some cases". Does that mean that in some cases it doesn't? What cases are that?

axellorreyne commented 1 year ago

I didn't have these errors while developing on another machine using a Firefox development build (110.0b3 64-bit) and running it from the manifest.json file but I did get them using the built-in web-ext browser that deploys on running web-ext verbose with npm.

I fixed this by calling the script, returning the import error, as a module in e5127b7f075be28452e22459343f249bdf377e10