Closed anodynos closed 10 years ago
If one were to implement this (importing index.js), which test cases would be the most relevant to look at? I might have a bash at this.
Unfortunatelly the /process
directory is fabulously absent from the unit tests :-( That where reading filenames and instantiating BundleFile
s takes place.
In short we need to replace dependencies like 'some/path/directory'
to 'some/path/directory/index'
(when index.js
is present), so it works on AMD/UMD properly.
I'll have a look on how to hack this quickly, so I can perhaps implement it or guide you to have a bash at it.
The 'dirname/index.js'
case is best handled at Dependency and be transparent in all other parts - Ill have a go about it.
Awesome, thanks.
On 13 August 2014 20:32, Agelos Pikoulas notifications@github.com wrote:
The 'dirname/index.js' case is best handled at Dependency https://github.com/anodynos/uRequire/blob/master/source/code/fileResources/Dependency.coffee and be transparent in all other parts - Ill have a go about it.
— Reply to this email directly or view it on GitHub https://github.com/anodynos/uRequire/issues/34#issuecomment-52098489.
[image: --] Will Price [image: http://]about.me/will_price http://about.me/will_price
Hey @willprice check it out - appending /index
in the dependency should work on both commonjs and AMD/UMD in version 0.6.19. Let me know if it worked OK for your project.
Note that the 2nd part (automatic generation of index.js
) is not dealt with - you need to have index.js
or index.coffee
etc in place
CommonJs/nodejs has
require('./someDirName')
which simply looks and requires'./someDirName/index.js'
'index.js'
, it could by default try create stub objects with all modules names as keys and the module as value, iewhere
require('./someDirName')
would return a generated objectWhat about nested subdirectories inside 'someDirName' ?