Fixed mechanism of loading components from directory.

Should check whether the directory can be required as a whole using
package.json or index.js.