Quantcast
Channel: Cannot use import statement outside a module(Vanilla Javascript) - Stack Overflow
Browsing latest articles
Browse All 4 View Live

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 Article



Cannot 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 Article

Answer by thegreytangent for Cannot use import statement outside a...

Just run your application by using your http server. Do not access it directly.

View Article

Answer 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
Browsing latest articles
Browse All 4 View Live




Latest Images