mathiasbynens / mathiasbynens/punycode.js

Update README to instruct how to alias the native one (due to Node 22 annoying warning)

Open
#137 6 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

- Node 22 will start showing warnings that `punycode` is deprecated, and a userland solution must be used
- Lots of 3rd party `node_modules` use native `punycode` and many are out of our control. It's too many. Especially because `node-fetch` depends on `punycode`, and even if this itself is now native .... we all know what a chaos is in `node_modules`.
- Anyway, what I did, was to install `module-alias` and then add before anything else (`node -r` or via `NODE_OPTIONS`):

```js
const moduleAlias = require('module-alias');
moduleAlias.addAlias('punycode', 'punycode/');
```

And it works.
I recommend adding this in the README. I can do it, if I know you will accept it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Update the README with the Node 22 workaround described in the issue, including installing module-alias and loading it with node -r or NODE_OPTIONS. Use the provided addAlias('punycode', 'punycode/') example; done means the README clearly explains how to redirect the native punycode import to the userland package.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.