Skip to content

[v14.x backport] loader: make require.resolve throw for unknown builtin modules#45263

Closed
danielleadams wants to merge 1 commit intonodejs:v14.x-stagingfrom
danielleadams:backport-43336-to-v14.x
Closed

[v14.x backport] loader: make require.resolve throw for unknown builtin modules#45263
danielleadams wants to merge 1 commit intonodejs:v14.x-stagingfrom
danielleadams:backport-43336-to-v14.x

Conversation

@danielleadams
Copy link
Contributor

Backports #43336

Fixes: nodejs#43274

PR-URL: nodejs#43336
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. v14.x labels Nov 1, 2022
@nodejs-github-bot
Copy link
Collaborator

Comment on lines +85 to +89
assert.strictEqual(require.resolve('https'), 'https');
assert.strictEqual(require.resolve('fs'), 'fs');

assert.throws(
() => require.resolve('unknown'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be passing when using the prefix, otherwise the original issue has not been fixed.

Suggested change
assert.strictEqual(require.resolve('https'), 'https');
assert.strictEqual(require.resolve('fs'), 'fs');
assert.throws(
() => require.resolve('unknown'),
assert.strictEqual(require.resolve('node:https'), 'node:https');
assert.strictEqual(require.resolve('node:fs'), 'node:fs');
assert.throws(
() => require.resolve('node:unknown'),

@danielleadams
Copy link
Contributor Author

Closing for now until I have a chance to revisit (or someone else picks up).

@danielleadams danielleadams deleted the backport-43336-to-v14.x branch November 8, 2022 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants