Bhaumin
Bhaumin3w 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
bartlomieju3w ago
You should have "url": "node:url" but honestly I'm not sure if we even support it
Bhaumin
Bhaumin3w 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
bartlomieju3w ago
Then you'll have to use it with prefix
Bhaumin
Bhaumin3w ago
ok thanks!