Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use node: protocol in imports #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Zearin
Copy link
Contributor

@Zearin Zearin commented Apr 15, 2023

The official docs have used the prefix in examples for years.

According to the NodeJS docs for Modules (§Core Modules), the node: “protocol” was added in:

  • NodeJS v16.0.0 (initial release 2021-04-20; source) and
  • (probablypossibly experimentally…?) v14.18.0 (released 2021-09-08; source)

Personally, I like how it makes it easy to distinguish:

  • 3rd party modules (no prefix) from
  • core modules (node: prefix) and
  • local modules (./ or ../ prefix).

The official docs have used the prefix in examples for years.

According to the NodeJS docs for [Modules (§Core Modules)](https://nodejs.org/dist/latest-v18.x/docs/api/modules.html#core-modules),
the `node:` “protocol” was added in NodeJS v16.0.0 (initial release
2021-04-20; [source](https://nodejs.dev/en/about/releases/)) and
(probably experimentally…?) v14.18.0 (released 2021-09-08;
[source](https://nodejs.org/en/blog/release/v14.18.0)).

Personally, I like how it makes it easy to distinguish 3rd party modules
(no prefix) from core modules (`node:` prefix) and local modules
(`./` or `../` prefix).
@zachleat
Copy link
Member

I haven’t found this to work in Node 14, which is our current Node minimum for a bit longer!

@Zearin
Copy link
Contributor Author

Zearin commented Apr 23, 2023

Okay, thanks! 🙏🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants