-
Notifications
You must be signed in to change notification settings - Fork 159
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
Importing in node 21 #132
Comments
Have you tried the following? import punycode from 'punycode/punycode.js' Your full error message may have suggested this. |
I did try it and it used to work. I'm traveling now so won't be able to
get you the exact error message till I get back next week. I'm using
"NodeNext" for the module settings.
…On 2023-11-03 09:18, Mike McCready wrote:
@BobFrankston [1]
Have you tried the following?
import punycode from 'punycode/punycode.js'
Your full error message may have suggested this.
--
Reply to this email directly, view it on GitHub [2], or unsubscribe
[3].
You are receiving this because you were mentioned.Message ID:
***@***.***>
Links:
------
[1] https://github.com/BobFrankston
[2]
#132 (comment)
[3]
https://github.com/notifications/unsubscribe-auth/ABJ4ONAT5WILPQUEI5KRTLTYCTVMBAVCNFSM6AAAAAA63GYALSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJSGQZDGNZSG4
|
I was able to remote in and tried that case. It now complains about the lack of a declaration file. I have installed @types/punycode but that didn’t solve it.
From: Mike McCready ***@***.***>
Sent: Friday, November 3, 2023 06:19
To: mathiasbynens/punycode.js ***@***.***>
Cc: Bob Frankston ***@***.***>; Mention ***@***.***>
Subject: Re: [mathiasbynens/punycode.js] Importing in node 21 (Issue #132)
@BobFrankston <https://github.com/BobFrankston>
Have you tried the following?
import punycode from 'punycode/punycode.js'
Your full error message may have suggested this.
—
Reply to this email directly, view it on GitHub <#132 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABJ4ONAT5WILPQUEI5KRTLTYCTVMBAVCNFSM6AAAAAA63GYALSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJSGQZDGNZSG4> .
You are receiving this because you were mentioned. <https://github.com/notifications/beacon/ABJ4ONCT5QH2CUK2S3DTGUTYCTVMBA5CNFSM6AAAAAA63GYALSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTK2Y3S6.gif> Message ID: ***@***.*** ***@***.***> >
|
You may want to consider following the instructions in the README > Installation, using the recommended code line: const punycode = require('punycode/'); It sounds like you are using TypeScript. |
I’m using typescript with modules so must use import. One option is to make a version available with an @ qualified name. I can do that with a clone but would rather use a supported version.
From: Mike McCready ***@***.***>
Sent: Friday, November 3, 2023 23:36
To: mathiasbynens/punycode.js ***@***.***>
Cc: Bob Frankston ***@***.***>; Mention ***@***.***>
Subject: Re: [mathiasbynens/punycode.js] Importing in node 21 (Issue #132)
@BobFrankston <https://github.com/BobFrankston>
I was able to remote in and tried that case. It now complains about the lack of a declaration file. I have installed @types/punycode but that didn’t solve it.
You may want to consider following the instructions in the README <https://github.com/mathiasbynens/punycode.js#installation> > Installation, using the recommended code line:
const punycode = require('punycode/');
It sounds like you are using TypeScript.
—
Reply to this email directly, view it on GitHub <#132 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABJ4ONHAXHDYJQG7QUYDJ2LYCXO5PAVCNFSM6AAAAAA63GYALSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGM3DANZQG4> .
You are receiving this because you were mentioned. <https://github.com/notifications/beacon/ABJ4OND4ML4E2KJVIUBEUUDYCXO5PA5CNFSM6AAAAAA63GYALSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTK4SBUG.gif> Message ID: ***@***.*** ***@***.***> >
|
Well I'm quite out of my depth by now, as I am no TypeScript expert, and this should probably be converted into an enhancement request for built-in TypeScript support, so that you don't have to jump through hoops. However, I tried to simulate what you're doing and after I added the following file, I didn't get errors from Filename: with the one line declare module 'punycode/punycode.js'; If that doesn't work, then it would be helpful if you could supply a minimum reproducible example, including
+ your TypeScript file that is using |
Thx I'll give it a tryGet Outlook for Android
|
I managed to remote in and it worked. Thanks.
Awkward but workable.
From: Mike McCready ***@***.***>
Sent: Saturday, November 4, 2023 07:31
To: mathiasbynens/punycode.js ***@***.***>
Cc: Bob Frankston ***@***.***>; Mention ***@***.***>
Subject: Re: [mathiasbynens/punycode.js] Importing in node 21 (Issue #132)
@BobFrankston <https://github.com/BobFrankston>
Well I'm quite out of my depth by now, as I am no TypeScript expert, and this should probably be converted into an enhancement request for built-in TypeScript support, so that you don't have to jump through hoops.
However, I tried to simulate what you're doing and after I added the following file, I didn't get errors from import.
Filename: punycode.d.ts
with the one line
declare module 'punycode/punycode.js';
If that doesn't work, then it would be helpful if you could supply a minimum reproducible example, including
package.json
tsconfig.json
+ your TypeScript file that is using punycode
—
Reply to this email directly, view it on GitHub <#132 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABJ4ONDSFUZW5BOPOKIJQHLYCZGSTAVCNFSM6AAAAAA63GYALSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGQ3DAMRUGA> .
You are receiving this because you were mentioned. <https://github.com/notifications/beacon/ABJ4ONFAFNIVSZ5M7VZNA33YCZGSTA5CNFSM6AAAAAA63GYALSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTK4YEBA.gif> Message ID: ***@***.*** ***@***.***> >
|
Maybe spoke too soon – still getting runtime error …
From: Bob Frankston ***@***.***>
Sent: Monday, November 6, 2023 20:40
To: 'mathiasbynens/punycode.js' ***@***.***>; 'mathiasbynens/punycode.js' ***@***.***>
Cc: 'Bob Frankston' ***@***.***>; 'Mention' ***@***.***>
Subject: RE: [mathiasbynens/punycode.js] Importing in node 21 (Issue #132)
I managed to remote in and it worked. Thanks.
Awkward but workable.
From: Mike McCready ***@***.*** ***@***.***> >
Sent: Saturday, November 4, 2023 07:31
To: mathiasbynens/punycode.js ***@***.*** ***@***.***> >
Cc: Bob Frankston ***@***.*** ***@***.***> >; Mention ***@***.*** ***@***.***> >
Subject: Re: [mathiasbynens/punycode.js] Importing in node 21 (Issue #132)
@BobFrankston <https://github.com/BobFrankston>
Well I'm quite out of my depth by now, as I am no TypeScript expert, and this should probably be converted into an enhancement request for built-in TypeScript support, so that you don't have to jump through hoops.
However, I tried to simulate what you're doing and after I added the following file, I didn't get errors from import.
Filename: punycode.d.ts
with the one line
declare module 'punycode/punycode.js';
If that doesn't work, then it would be helpful if you could supply a minimum reproducible example, including
package.json
tsconfig.json
+ your TypeScript file that is using punycode
—
Reply to this email directly, view it on GitHub <#132 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABJ4ONDSFUZW5BOPOKIJQHLYCZGSTAVCNFSM6AAAAAA63GYALSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGQ3DAMRUGA> .
You are receiving this because you were mentioned. <https://github.com/notifications/beacon/ABJ4ONFAFNIVSZ5M7VZNA33YCZGSTA5CNFSM6AAAAAA63GYALSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTK4YEBA.gif> Message ID: ***@***.*** ***@***.***> >
|
I just submitted a patch for this to DefinitelyTyped: DefinitelyTyped/DefinitelyTyped#68273 🎉 |
I'm trying to convert to the userland vs the built-in Punycode but node seems to have tightened the rules.
import puny from 'punycode/'
generates an ERR_UNSUPPORTED_DIR_IMPORT error. What is the proper module syntax?
The text was updated successfully, but these errors were encountered: