Skip to content

relative paths break? #3

Description

@Pomax

I'm using the following test code, and am getting an interesting error.

var hook = require('node-hook');
function preprocess(source, filename) {
  return source;
}
['js','jsx'].forEach(function(ext) { hook.hook('.' + ext, preprocess); });

Pretty straight-forward pass-through processing, the expectation is that this, of course, does nothing. Instead, it causes and error on the following line later in the same file (line 19 in the file) :

...
var RouteSet = require('../lib/site/routes');
...

Claiming:

module.js:328
    throw err;
    ^

Error: Cannot find module '../lib/site/routes'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (J:\Junctions\Users\Mike\Documents\Git projects\projects\BezierInfo-2\pages\test.js:19:16)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:430:10)

Without node-hook, this works just fine, it's just a relative file location, but with node-hook, things no longer work for relative requirements... I tried to change it to ../lib/sites/routes.js because maybe the automatic extension from node's site isn't kicking in, but that just gives the same error:

module.js:328
    throw err;
    ^

Error: Cannot find module '../lib/site/routes.js'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (J:\Junctions\Users\Mike\Documents\Git projects\projects\BezierInfo-2\pages\test.js:19:16)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:430:10)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions