Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
totpero opened this issue Nov 5, 2022 · 6 comments

Comments

@totpero
Copy link

totpero commented Nov 5, 2022

In Mozilla Firefox console I get this error:
Uncaught SyntaxError: import declarations may only appear at top level of a module "ol-contextmenu.js:11"
Using last release v5.1.0 at line 11
This line: import T from "ol/control/Control";

@jonataswalker
Copy link
Owner

Hey there @totpero

Please provide a reproduction.

@Saurbaum
Copy link
Contributor

I have a very similar one

openlayers.zip

Uncaught SyntaxError: Cannot use import statement outside a module (at ol-contextmenu.js:11:1)

@jonataswalker
Copy link
Owner

Hopefully solved in 5.2.0 by #260

@totpero
Copy link
Author

totpero commented Mar 13, 2023

Hi @jonataswalker ,
No this commit not fix this error.
Now the error move to other line:
Uncaught SyntaxError: export declarations may only appear at top level of a module ol-contextmenu.js:923
Here:

export {
  me as default
};

@jonataswalker
Copy link
Owner

I'm not able to help without a reproduction.

https://stackoverflow.com/help/minimal-reproducible-example

@totpero
Copy link
Author

totpero commented Mar 15, 2023

Hi @jonataswalker,
If you try to include ol-contextmenu.js in your project you will get this error in firefox, but I saw in your demo you use ol-contextmenu.iife.js and with this I don't get any error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants