↧
Answer by Safwen Hafsawy for Cannot use import statement outside a...
this was simply solved by adding type="module" to my script tags and serving my web files from an HTTP server running on localhost instead of opening the html file directlythese answers were helpful...
View ArticleCannot use import statement outside a module(Vanilla Javascript)
when i tried to import a class from one js file to another i got this errorUncaught SyntaxError: Cannot use import statement outside a modulewhen i added type="module" to my script tags i got this...
View ArticleAnswer by thegreytangent for Cannot use import statement outside a...
Just run your application by using your http server. Do not access it directly.
View ArticleAnswer by Bravo Stack for Cannot use import statement outside a...
First off, you have to include the type="module" attribute in your script tag.Secondly, when using the import statement, don't leave out the file extension, in this case .js.e.g: import { sqrRoot }...
View Article