Universal package name prefix to represent standard library #5081
Replies: 2 comments 3 replies
-
These standard libraries are exclusive to Node.js. Other runtimes make it their goal to make compatible implementations, but at the end of the day, they are different libraries. This prefix ( However, many thanks for taking the time to give us feedback, and we look forward to seeing more in the future 😃. |
Beta Was this translation helpful? Give feedback.
-
Hey, I get where you’re coming from it would be nice if there was a “universal” way to signal standard libraries across all the popular runtimes. But honestly, as others have pointed out, the reality is each runtime implements its own standard library, even if the APIs look really similar. The node: prefix just makes it clear you are relying on Node’s version, which isn’t always a 1:1 match with Bun or Deno. I do like the idea of a std: or runtime: prefix, but since there is no official shared standard between all these runtimes, it might create more confusion than clarity. Until there’s an actual “universal” standard library agreed on by all runtime authors (which is a huge ask), sticking to the current prefixes is probably safest. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently you can use
node
such asimport fs from 'node:fs';
to tell Node that this package is apart of the standard library. However many of the standard libraries in NodeJS are also available in other runtimes such as Deno or Bun. And when you useimport fs from 'node:fs';
in Deno or Bun to use the standardfs
library, it looks a bit odd since your not using Node.I would like to suggest adding another prefix name to packages that are apart of the standard library for NodeJS. By having a secondary prefix name, it will also suggest that this standard library is not exclusive to NodeJS. Here are some name ideas
import fs from 'runtime:fs';
import fs from 'std:fs';
Beta Was this translation helpful? Give feedback.
All reactions