I'm unsure about the best approach when it comes to using ES6 modules and the revealing module pattern. Is the data/functionality in an ES6 module as secure as in an IIFE?
Should I stick with just ES6 modules, like this:
// Export file
export const test = () => {
console.log('Hello from test');
}
// Import file
import { test } from "./test.js";
test();
Or would it be better to use a combination of both:
// Export file
export const revealingPattern = (function() {
function test() {
console.log('Hello from test');
}
return {
test
}
})();
// Import file
import { revealingPattern } from "./test.js";
revealingPattern.test();