We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Plonk.
tryRequire just calls require.resolve which will, for local files, start relative to the file that contains it.
tryRequire
require.resolve
Therefore, if you try to require a file with a relative path that could resolve to a similarly named file from the util folder in meddleware, 💥.
util
Proof:
$ echo "console.log('i am required');" > rq.js $ cat - > index.js <<EOF const meddleware = require('meddleware'); const express = require('express'); const app = express(); const config = { example: { module: './rq.js' } }; app.use(meddleware(config)); EOF $ node index.js /cat/city/secret/path/node_modules/meddleware/index.js:100 throw new Error('Unable to locate middleware in ' + config.name); ^ Error: Unable to locate middleware in ./rq.js
The text was updated successfully, but these errors were encountered:
Fix edge case with local resolve - fixes krakenjs#81
96ea7bb
@jasisk I took a shot in #82 but I'm not sure it's the right approach. Will let you decide.
Sorry, something went wrong.
No branches or pull requests
Plonk.
tryRequire
just callsrequire.resolve
which will, for local files, start relative to the file that contains it.Therefore, if you try to require a file with a relative path that could resolve to a similarly named file from the
util
folder in meddleware, 💥.Proof:
The text was updated successfully, but these errors were encountered: