Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relative paths break? #3

Open
Pomax opened this issue Jan 17, 2016 · 0 comments
Open

relative paths break? #3

Pomax opened this issue Jan 17, 2016 · 0 comments

Comments

@Pomax
Copy link

Pomax commented Jan 17, 2016

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant