Revealing Module pattern vs es6 export and import

Hi i just learnt about the module pattern using IFFE and closures so that you don’t pollute the global namespace and encapsulate method and variables inside the iffe. I then came across export and import using ES6 which is commonly used in react etc.

Is the module pattern still useful in modern browsers or is unnecessary due to export/import in es6.

Also, do global variables declared in the module using es6 pollute the global namespace? because i read some articles that say they are treated as private , for example

// index.js
let a = 5;
let b = 6

export function add(){
return a + b;
}

does a and b here in this module pollute global namespace or treated as private in es6 modules?

You can still use the IIFE patterns.

Top-level variables are local to the module.