JavaScript ES6 - How to fix Unexpected token import

preview_player
Показать описание
This video is a short explanation on how to fix the syntax error: "Unexpected Token Import"

Hint: type="module"
Рекомендации по теме
Комментарии
Автор

Master!!!, I've spent hours trying to solve it, frustration was one step of driving me crazy.

horaciotena
Автор

I spent over 3 hours trying to figure this out. Thank you so much!

dimitrifranov
Автор

U SAVED MY THANK YOU. this was really begining to annoy me, almost went back to the old attach everything "script tag" method because of this

shaquillerichards
Автор

Thanks for this I was spinning in circles way too long before I saw this video.

relyk
Автор

Thanks a lot for this fix, you saved me a bunch of time!

jimboobrien
Автор

Saved me time too. Thanks for taking the time to share!

michaelsutherland
Автор

Thanks for a great tip. Solved a problem that wasted a lot of time.

thomasgdowling
Автор

I still got the problem
And my js code is inside my html. Code

litetrack
Автор

I figured this out elsewhere, then forgot, kicked myself and so happened to find your video today. Good stuff. "Liked"

edgeofthought
Автор

it still not console.logging for me. can you post your source code online?

XXX-ndzz
Автор

Thank you very much for this. was stuck on this and finally a simple solution. Ty ty

wingsaver
Автор

Thank you, thank you and thank you again :)

Dowmiir
Автор

Thanks a lot!
Google and the first responses on Stackoverflow failed me this time.
I found various EC6 tutorials from 2015 and how not all browsers support them, but was using the latest build of Chrome Canary, so I knew something was off.

They really should look into giving better feedback on that error message that is usually due to the exact reasons presented here; and save people a lot of frustration.
Any idea where one should best propose such a suggestion?

LinkEX
Автор

It doesn't work for me chrome says "Access to Script at '[PATH TO SCRIPT]' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.

louishun
Автор

har det samme problem men med en json fil, har du en løsning til det?
min syntax er;
loadJSON("url", gotData, "jsonp");
tak på forhånd

oscarstorm
Автор

but my error indicating the line <br/> please help me to solve this

balasankar
Автор

can I use this in vanilla javascript? cuz I have tried it but it not working. It show same error... I will be glad to see an answer. Thanks

ThePelumiAdebayo
Автор

finaly i find solution for this problem

fadinum
Автор

ok but how do you fix it when its a { or a }

shbzyy
Автор

I don't know scripting .. but once, i saw a script.. took screenshot, and i typed that script in notepad, and executed in website console.. and showed "uncaught syntax error.." i wanted that script. . But no money to buy.. and i did like this.. ending in error message. . Can u help me to fix this error?

justachannel