Skip to content

fix: always use native for node: specifiers#392

Merged
pi0 merged 4 commits intounjs:mainfrom
sjinks:GH-391
Sep 22, 2025
Merged

fix: always use native for node: specifiers#392
pi0 merged 4 commits intounjs:mainfrom
sjinks:GH-391

Conversation

@sjinks
Copy link
Copy Markdown
Contributor

@sjinks sjinks commented Aug 2, 2025

resolves #391

This pull request refactors the jitiRequire function in src/require.ts to resolve the issue with detecting prefix-only built-in modules, such as node:test.

I'd love to add tests, but I was unable to find any that deal with the node: protocol.

To test:

test.mts:

import { test } from 'node:test';

test('noop', {});

Run:

node --import jiti/register --test test.mts

Without this patch, a MODULE_NOT_FOUND error will occur.
With this patch, the script will successfully run.

@pi0 pi0 changed the title fix: detection of prefix-only builtin modules fix: always use native for node: specifiers Sep 22, 2025
@pi0 pi0 merged commit c3f6ff4 into unjs:main Sep 22, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Cannot find module 'test'

2 participants