react-validation-mixin icon indicating copy to clipboard operation
react-validation-mixin copied to clipboard

These modules are missing...

Open qynAUGMN opened this issue 10 years ago • 19 comments

ERROR in ./~/joi/lib/string.js Module not found: Error: Cannot resolve module 'net' in /Users/russell/Work/augmn/tcms/node_modules/joi/lib @ ./~/joi/lib/string.js 3:10-24

ERROR in ./~/joi/~/isemail/lib/isemail.js Module not found: Error: Cannot resolve module 'dns' in /Users/russell/Work/augmn/tcms/node_modules/joi/node_modules/isemail/lib @ ./~/joi/~/isemail/lib/isemail.js 1188:18-32

qynAUGMN avatar May 14 '15 04:05 qynAUGMN

@qynAUGMN make sure you install the peer dependency Joi:

> npm install --save joi

jurassix avatar May 14 '15 12:05 jurassix

Still not working for me

sebslomski avatar May 15 '15 10:05 sebslomski

This issue seems appear only with webpack. I forked isemail and removed the unneeded stuff (http://github.com/travelio/node-isemail)

sebslomski avatar May 15 '15 11:05 sebslomski

👏

On Friday, May 15, 2015, Sebastian Slomski [email protected] wrote:

This issue seems appear only with webpack. I forked isemail and removed the unneeded stuff (travelio/isemail)

— Reply to this email directly or view it on GitHub https://github.com/jurassix/react-validation-mixin/issues/17#issuecomment-102370375 .

qynAUGMN avatar May 15 '15 12:05 qynAUGMN

https://github.com/hapijs/joi/issues/528 seems to suggest isemail is not supported by the browser and should be shimmed for the client.

jurassix avatar May 15 '15 14:05 jurassix

@sebslomski How would you go about using this branch with Joi? Also how did you deal with the net dependency.

rbhalla avatar Jun 11 '15 10:06 rbhalla

Any workarounds?

real-ashwin avatar Jun 15 '15 21:06 real-ashwin

As @jurassix mentioned, hapijs/joi#528 solves the problem.

sebslomski avatar Jun 16 '15 14:06 sebslomski

I just installed node-libs-browser and added these lines to webpack.config:

node: {
 net: 'empty',
 tls: 'empty',
 dns : 'empty'
}

Messages about missing 'net' and 'dns' modules now disappeared, but now I'm getting:

ERROR in chunk main [entry]
js/bundle.js
No template for dependency: TemplateArgumentDependency

And it breaks build process of webpack. Any other ideas?

P.S. As joi is not usable with webpack is it possible to switch to other validation libraries (business-rules-engine?)?

vguzev avatar Aug 21 '15 09:08 vguzev

@vguzev - currently this library only supports Joi; support for other validation engines will be available in the next major release.

jurassix avatar Aug 21 '15 14:08 jurassix

Sounds promising, but I'm afraid that we'll have to switch to something else before this release is available. I'm currently evaluating React validation modules for one big project. According to README.md react-validation-mixin is actually what we need, but I can't even evaluate it as it is not compatible with webpack... ((

P.S. I think you should define some kind of "interfaces" for validation engines, so they could be pluggable.

vguzev avatar Aug 21 '15 16:08 vguzev

@vguzev you can now write your own strategy as of 5.0

Documentation for 5.0

jurassix avatar Aug 31 '15 23:08 jurassix

How do you guys use this if not with webpack? I imagine browserify would have the same issues as webpack?

dminkovsky avatar Oct 08 '15 21:10 dminkovsky

PS. Haven't tested isemail-related functionality, but I followed https://github.com/hapijs/joi/issues/528#issuecomment-74263885 and my bundle built with webpack. Wasn't aware of the node property in webpack config. Yay.

dminkovsky avatar Oct 08 '15 21:10 dminkovsky

@dminkovsky I use Browserify. The DEMO is also built using Browserify and emails validate correctly without any shims.

I'll add a synopsis to the documentation for webpack so this information is straightforward to find for the next users.

jurassix avatar Oct 09 '15 13:10 jurassix

+1

dsteinbach avatar Oct 23 '15 21:10 dsteinbach

Hi @jurassix. Thanks for that. I've also got emails validating with my webpack build. Doesn't do the whole DNS bit but that's what it is in the client without trying to get fancy.

By the way, thanks for this module. A while back I opened an issue in the Ampersand repository basically suggesting this very module. Thanks for making this happen :).

dminkovsky avatar Oct 27 '15 01:10 dminkovsky

I'm also using webpack and getting the same errors.

ERROR in ./~/joi/lib/string.js Module not found: Error: Cannot resolve module 'net' in ....node_modules/joi/lib @ ./~/joi/lib/string.js 5:12-26

ERROR in ./~/isemail/lib/index.js Module not found: Error: Cannot resolve module 'dns' in .../node_modules/isemail/lib @ ./~/isemail/lib/index.js 5:12-26

sgentile avatar Jan 12 '16 20:01 sgentile

I had to add the following to my webpack config for my node app to get rid of those errors.

https://github.com/hapijs/joi/issues/665 https://github.com/hapijs/joi/issues/768

        node: {
          net: 'empty',
          tls: 'empty',
          dns: 'empty'
        },

idealistic avatar Feb 23 '16 18:02 idealistic