[core][js] use typeof(require) instead of typeof(exports)