devmehq / email-validator-js

Verify email address checking MX records, and SMTP connection, check for disposable email addresses and free email providers.
https://dev.me/products/email
MIT License
75 stars 21 forks source link

Can't resolve 'dns' in ./node_modules/@devmehq/email-validator-js/dist/dns.js #218

Closed diennn-gg closed 6 months ago

diennn-gg commented 6 months ago

I have an error: Can't resolve 'dns' in ./node_modules/@devmehq/email-validator-js/dist/dns.js. Nodejs: v18.

Please help to resolve this error. Thanks

YPCrumble commented 6 months ago

The full error includes:

Did you mean './dns' Requests that resolve in the current directory need to start with './'.

This is using Webpack for compilation.

meabed commented 6 months ago

Can you make a repo or codesanbox that reproduce the issue

diennn-gg commented 6 months ago

I send demo link at here @meabed https://codesandbox.io/p/sandbox/demo-dnzly5?file=%2Fsrc%2FApp.js

YPCrumble commented 6 months ago

Is it possible that this package's dns.ts is conflicting with node's builtin dns module? And that renaming this package's dns.ts to something like dns-records.ts would solve the issue?

meabed commented 6 months ago

@YPCrumble @diennn-gg

This issue is due to the dns module in nodejs not available in browser / client side.

This library is meant to be used in backend services not in the browser.