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

Resolve JSON files from extensionless parameters #20

Closed
wants to merge 1 commit into from

Conversation

SLaks
Copy link

@SLaks SLaks commented May 10, 2013

Fixes #19

@michaelficarra
Copy link
Contributor

+1

@treygriffith
Copy link

👍 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

@alexisvincent
Copy link

+1

@virtulis
Copy link

virtulis commented Jul 5, 2016

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' ];
Copy link
Member

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';
Copy link
Member

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

@ljharb
Copy link
Member

ljharb commented Mar 7, 2018

Closing this in favor of either #145 or #138 (my preference of the two).

@ljharb ljharb closed this Mar 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

opts.extensions should include '.json'
7 participants