Is it possible to check if JavaScript file is being run directly or if it was required as part of an es6 module import.
for example a main script is included.
module.parent will help you:
if(module.parent) { console.log('required module') } else { console.log('main') }