Closed guybedford closed 10 years ago
We can allow this in the following way:
When installing a package from npm, we check for any files called index.js
in sub-directories. If such a file is found, we create a file with the same name as the directory, subdirectory.js
, containing a direct link to the index file - module.exports = require('./subdirectory/index')
. If such a file name already exists, we don't overwrite it. In this way we get a full match with npm behaviour!
This is now supported.
Modules can import a directory by name, which results in the
index
being loaded from that directory. We should detect these require forms within the local package and convert them into theindex
reference.