-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Resolve JSON files from extensionless parameters #20
Conversation
+1 |
👍 I've noticed that the Node docs don't mention it in the pseudocode but it is mentioned in the prose about requiring files as modules |
+1 |
wonder if there's a reason this wasn't merged :( |
@@ -13,7 +13,7 @@ module.exports = function (x, opts) { | |||
}; | |||
var readFileSync = opts.readFileSync || fs.readFileSync; | |||
|
|||
var extensions = opts.extensions || [ '.js' ]; | |||
var extensions = opts.extensions || [ '.js', '.json' ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing .node
- instead, could we use the keys in require.extensions
, which should ensure that the array always matches the require algorithm?
(if there's a concern that browserify won't be able to handle require.extensions
, then let's add .node
to the list also)
@@ -21,6 +21,26 @@ test('foo', function (t) { | |||
t.end(); | |||
}); | |||
|
|||
test('JSON', function (t) { | |||
var dir = __dirname + '/resolver'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should use path.join(__dirname, 'resolver')
instead
Fixes #19