diff --git a/src/node.js b/src/node.js index 5034e31f3c..0f3fb4c45c 100644 --- a/src/node.js +++ b/src/node.js @@ -251,6 +251,7 @@ var module = (function () { this.filename = filename; var extension = path.extname(filename) || '.js'; + if (!extensions[extension]) extension = '.js'; extensions[extension](this, filename); this.loaded = true; }; diff --git a/test/fixtures/registerExt.hello.world b/test/fixtures/registerExt.hello.world new file mode 100644 index 0000000000..0420edca79 --- /dev/null +++ b/test/fixtures/registerExt.hello.world @@ -0,0 +1 @@ +exports.test = 'passed' diff --git a/test/simple/test-module-loading.js b/test/simple/test-module-loading.js index 9c9cfeb7e2..bdff4a9d2d 100644 --- a/test/simple/test-module-loading.js +++ b/test/simple/test-module-loading.js @@ -76,6 +76,8 @@ require.extensions['.test'] = function (module, filename) { }; assert.equal(require('../fixtures/registerExt').test, "passed"); +// unknown extension, load as .js +assert.equal(require('../fixtures/registerExt.hello.world').test, "passed"); common.debug('load custom file types that return non-strings'); require.extensions['.test'] = function (module, filename) {