2

I'm using the npm module punycode in my Angular project. VsCode tells me it's deprecated and https://nodejs.org/api/punycode.html#punycode_punycode confirms:

The version of the punycode module bundled in Node.js is being deprecated. In a future major version of Node.js this module will be removed. Users currently depending on the punycode module should switch to using the userland-provided Punycode.js module instead. 

The suggestion is to switch to the 'userland-provided' module. What is that?

There is a link to https://github.com/mathiasbynens/punycode.js and I tried including that in my package.json instad of 'punycode' and I get the same error.

RobC
  • 22,977
  • 20
  • 73
  • 80
Ben Taliadoros
  • 7,003
  • 15
  • 60
  • 97
  • Did you import the module as instructed in the readme: `const punycode = require('punycode/');`? – Absor Aug 13 '21 at 15:38
  • I think that is for node.js, as it's Angulare we're just using the es6 imports, not the commonJs node ones – Ben Taliadoros Aug 13 '21 at 15:40
  • 1
    It is just to change from where it is resolved. You have to force the import to come from local (node_modules etc.) rather than from node.js libraries. Try `import punycode from "punycode/";` for example. – Absor Aug 13 '21 at 15:43
  • I have done this, and changed the usages for (for example) toUnicode to punycode.toUnicode() which does "suppress" the deprecation error, but I'm not sure as there is no type knowledge (toUnicode is 'any'), so I will need to check this further and see. Thanks though. – Ben Taliadoros Aug 13 '21 at 16:10

0 Answers0