Importing a self invoking function

The effect will run when the module is evaluated, which happens when it is imported at least once in some other module.

You don't need an IIFE at all, ES6 modules already provide their own scope.

You don't need to export anything, as all your module is supposed to do is execute the side effect. It does not have a result value. (Which could be considered a design flaw, but let's not discuss that).

All you need to do is

// myEffect.js
… // yada yada

// main.js
import 'myEffect.js';