JavaScript: fix “SyntaxError: cannot use import statement outside a module”

JavaScript: fix “SyntaxError: cannot use import statement outside a module”

Autopublished from RSS Original article

javascript

I recently was working with a third-party library. I ran into the error “Uncaught SyntaxError: cannot use import statement outside a module” when I tried to import a function from the package. Let us look into why it occurred and how I fixed it. The error description “Uncaught SyntaxError: cannot use import statement outside a module” gives us some hints as to what is happening, but it is still...

Source