[core][js] conditional requires and variable renaming to avoid overridding