Improve extension entry point

Simplify the ResourceLoader module definitions and
avoid leaking variables into global scope.

Change-Id: I19334e84c4cd065324f45005a61c525271a9a769
Merge "Improve extension entry point"