ES6-modules and why you should care
tl;dr ES6-modules are amazing and are blessing for web development, they help you build the app modularly without worrying about including, and polluting the html, like in old days also without the overhead of any third-party module loaders or dependency resolvers.
To better understand es6-module I recommend you read up this blog post by Axel Rauschmayer. The blog post gives the full detail on ES6-module system.
To see if your current browser had support for it or not use this link. I’ve also created a small project (bare bones, plan to make it better) which you can find at this location https://github.com/chhetrisushil/module-example
Brief About the example
The key parts to notice about ES6-modules are now we have a value to the “type” attribute in script tag as “module” so the tag looks like this <script type=”module” src=”./path/to/module.js”></script>. In this “module.js” now u can make use of “import” statements the usual way.
Another attribute has been introduced to script called “nomodule” which I’m exploring and perhaps my next article might as well be about it and how it’s helpful for migration and different from “module”.
Hope this article is enough to get you curious about ES6-modules and may as well motivate to experiment/build apps using ES6-modules.
EDIT: Thanks Sravan kumar Rekandar for the feedback :)