Call factory with context, otherwise missing

Within factory root would be localRequire in the case of an AMD or UMD definition (first two conditionals). To fix this we call the factory with the proper root in such cases.