With ES6 JavaScript changed from a programming language that many people dreaded using to one of the most popular and loved languages. Of the new changes in ES6 the addition of modules was one of, if not, the biggest change that pushed JavaScript to where it is now. Modules make it so much easier to write clean and reusable code. In this video we will discuss how to use ES6 modules and why they are so important to JavaScript.
Twitter:
Tweets by DevSimplified
GitHub:
https://github.com/WebDevSimplified
CodePen:
https://codepen.io/WebDevSimplified
#JavaScript #ES6 #Modules
Original source
27 responses to “JavaScript ES6 Modules”
absolute brilliant
you understand web development in depth.
i am currently preparing for my job at amazon front end.
what do you recommend me ??
Why didn't you mention that webserver was needed to serve the export file 😠😠😠😡😡😡😡😡😡😡😡😡😡😡😡
A little smile wouldn't kill ya @WebDev
My man great VIDEO! Totes helping me out with my development. Keep up the awesome work and I hope you getting paid!
Your explanation is so clear, every time..
Good video but these imports serve the same purpose as PHP's `include` which made it very efficient for churning out spaghetti code for inexperienced users. IMO, JS is starting to get messy.
This cracked open modules for me finally, thanks!
Holy fucking shit… I finally understand what modules are, and not only that, now I finally understand when you're supposed to use braces in import statements and when not to… Bro, you deserve to be world-famous, seriously. This is amazing.
u are really simplifying the javascript thanks man
Is it bad to add the type="module" attribute to every script element. Even when they don't use modules?
Dude, you're really cool!!!!
YOU DESERVE WAYYYY MORE VIEWS MY MAN
Hello, I have a problem that's giving me trouble – so, I did everything like in the video, even added the type="module" attribute tot the script but it's not working. I'm getting 2 errors – "Access to script at 'file:///G:/Projects/catalogue/js/app.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. " and "GET file:///G:/Projects/catalogue/js/app.js net::ERR_FAILED". Some info would be appreciated.
just what i needed
So it's like node minus the "module"
can i get this code?
`User's name is ${user.age}`. I see.
Hey, man, appreciate the content! I have a problem – when I import the User class I get an error in Mozilla that my file was blocked because of a disallowed MIME type (“text/html”) – I gave a type module in the html, not sure what's happening. Can you give me an advice how to fix this, or maybe I did something wrong? Thanks a lot!
thx
Hi there. How would you test ES6 code (like a utils.js) in something like mocha, where you can't do import and a require() complains about the export command? I'm having trouble finding good articles on it. If you read this, thanks.
Hey, u have missed something
U didn’t use sentence “which is perfect”
I’m not mad bro, I’m just disappointed.
It’s now end of dec. 2019. Global support is now 86%. See https://caniuse.com/#feat=es6-module-dynamic-import Note that Microsoft browsers still lag behind.
Nice tutorial bro
I have seen this on React… I say I have seen it because I have not properly learn Reach yet, I am learning modern JS currently but I have seen tutorials where import and export is being use with the same functionality shown in the video… are Modules similar to what they do in React?
How do you get vscode to recognize es6?
Hi, anybody know how to solve this, CORS POLICY?
Error: Access to Script at 'file:///C:*******/es6/code.js' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.
It seems it is well supported now. Is it bad practice to develop front end apps (Vue) using ES6 modules only, without build tools?