DEV Community

Discussion on: JavaScript Modules

Collapse
 
raddevus profile image
raddevus

This is a great article on Modules. I am a long-time dev (with C++ / OOP background) so seeing Modules in JavaScript is a step in the right direction. However, I've often been confused by explanations of how to use export import.
This was written up nicely and provides value for me. Couple of things I'm wondering about: 1) which version(s) of JS does this work in? 2) is this the same syntax you would use in NodeJS?
Thanks

Collapse
 
kiranrajvjd profile image
Kiran Raj R
  1. ES modules are defined in the ES2015 specification. Import And exports are not supported in Internet explorer, for browser compatibility you can use "caniuse.com".
  2. Modules was partially supported from Node.js v8.5 , CommonJS modules are used in node by default which do the same functions of ECMAScript module . Currently node support ECMAScript module fully. You can find the syntax in node documentation. Hope this will help you to some extent, thank you for asking the questions.