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

Getting extractDomain.default is not a function #31

Closed
geraldosalazar16 opened this issue Nov 17, 2023 · 3 comments
Closed

Getting extractDomain.default is not a function #31

geraldosalazar16 opened this issue Nov 17, 2023 · 3 comments

Comments

@geraldosalazar16
Copy link

geraldosalazar16 commented Nov 17, 2023

I tried to import as per the library docs
import extractDomain from 'extract-domain';
And then use it like

const urls = await extractDomain("https://www.mydomain", {
 tld: true,
 });

but it throws
extractDomain.default is not a function

Also tried
import * as extractDomain from 'extract-domain';
And then use it like

const urls = await extractDomain.default("https://www.mydomain", {
 tld: true,
 });

But got the same error

The only way I was able to make it work was by doing
const extractDomain = require('extract-domain');
And then use like in the first case

I am using typescript 5.1.6

@geraldosalazar16
Copy link
Author

geraldosalazar16 commented Nov 17, 2023

I created this repo reproduce and this stackblitz to reproduce

@bjarneo
Copy link
Owner

bjarneo commented Nov 19, 2023

Thanks. This is strange behaviour. I will look into this!

@bjarneo
Copy link
Owner

bjarneo commented Apr 9, 2024

From version 5, it will support ESM only.

@bjarneo bjarneo closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants