Bhaumin
Bhaumin3mo ago

Import built-in Node module from deno.json imports

How can we import built-in Node modules by adding imorts to deno.json? We are getting below error when we do it
error: Relative import path "url" not prefixed with / or ./ or ../
If you want to use a built-in Node module, add a "node:" prefix (ex. "node:url").
error: Relative import path "url" not prefixed with / or ./ or ../
If you want to use a built-in Node module, add a "node:" prefix (ex. "node:url").
But we have added "url/*": "node:url" to our deno.json imports.
4 Replies
bartlomieju
bartlomieju3mo ago
You should have "url": "node:url" but honestly I'm not sure if we even support it
Bhaumin
BhauminOP3mo ago
we tried to add it in import map as you said but getting error: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:url").
bartlomieju
bartlomieju3mo ago
Then you'll have to use it with prefix
Bhaumin
BhauminOP3mo ago
ok thanks!