joi
joi copied to clipboard
Is JOI usable in browser?
Support plan
- is this issue currently blocking your project? (yes/no): yes
- is this issue affecting a production system? (yes/no): no
Context
- node version: N/A
- module version: 17.7.0
- environment (e.g. node, browser, native): browser (just TSC compilation)
- used with (e.g. hapi application, another framework, standalone, ...): in an Open WC generator project
- any other relevant information:
How can we help?
I have used JOI previously on my Node apps. I am now doing something client side, although I will hit server endpoints. I want to share the validation across both. I do import Joi from 'joi';
after turning on esModuleInterop
in TS config, as it told me. In the browser I get this error:
The requested module './../../../node_modules/joi/lib/index.js' does not provide an export named 'default'
I saw elsewhere that this is supposed to work in React create app, but that uses Webpack. Is that a requirement of using this package in browser??