-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
module: revert checking for package.json before extensions #15015
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = {}; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "main": "./package.json" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| 'use strict'; | ||
| // fixes regression from v4 | ||
| require('../common'); | ||
| const assert = require('assert'); | ||
| const fixtures = require('../common/fixtures'); | ||
| const path = require('path'); | ||
|
|
||
| const fixturesRequire = require( | ||
| fixtures.path('module-extension-over-directory', 'inner')); | ||
|
|
||
| assert.strictEqual( | ||
| fixturesRequire, | ||
| require(fixtures.path('module-extension-over-directory', 'inner.js')), | ||
| 'test-require-extension-over-directory failed to import fixture' + | ||
| ' requirements' | ||
|
||
| ); | ||
|
|
||
| const fakePath = [ | ||
| fixtures.path('module-extension-over-directory', 'inner'), | ||
| 'fake', | ||
| '..' | ||
| ].join(path.sep); | ||
| const fixturesRequireDir = require(fakePath); | ||
|
|
||
| assert.strictEqual( | ||
| fixturesRequireDir, | ||
| require(fixtures.path('module-extension-over-directory', 'inner/')), | ||
| 'test-require-extension-over-directory failed to import fixture' + | ||
| ' requirements' | ||
| ); | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
👆 at the moment because the trailing slash check is for forward-slash-only, on Windows paths ending in a backslash hit that code path (which is removed in this PR). This means it will now fall through to the
tryExtensionscall on line 234, instead of thetryPackagecall on line 243.Note: Assumes a fixed #18299