Permalink
Browse files

Make sure both the path and indexed path are used to see if a module …

…already exists in the cache. Fixes #62
  • Loading branch information...
cengebretson committed Jan 31, 2013
1 parent 2b612fa commit 0dfde0806bdbe22b47dd8bb8414015f76eea1ced
Showing with 3 additions and 2 deletions.
  1. +3 −2 assets/stitch.eco
View
@@ -2,10 +2,11 @@
(function(/*! Stitch !*/) {
if (!this.<%= @identifier %>) {
var modules = {}, cache = {}, require = function(name, root) {
- var path = expand(root, name), module = cache[path], fn;
+ var path = expand(root, name), indexPath = expand(path, './index'), module, fn;
+ module = cache[path] || cache[indexPath]
if (module) {
return module.exports;
- } else if (fn = modules[path] || modules[path = expand(path, './index')]) {
+ } else if (fn = modules[path] || modules[path = indexPath]) {
module = {id: path, exports: {}};
try {
cache[path] = module;

0 comments on commit 0dfde08

Please sign in to comment.