IIFE < CommonJS < ES6 modules

There’s one more difference between CommonJS modules and ES Modules that we didn’t cover above.

With CommonJS (require) , you can require a module anywhere, even conditionally.

if (pastTheFold === true) {  require('./parallax') }

Because ES Modules (import) are static, import statements must always be at the top level of a module. You can’t conditionally import them.

if (pastTheFold === true) 
{
import './parallax'
// "import' and 'export' may only appear at the top level" }

Experience with Front-end Technologies and MERN / MEAN Stack. Working on all Major UI Frameworks like React, Angular.