Skip to content

Conversation

@sjinks
Copy link
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