hapijs / hapijs/joi

Is JOI usable in browser?

Open
#2,901 4 comments 0 reactions 0 assignees View on GitHub
support
Dominant language
JavaScript
Stars
21.2k
Forks
1.5k
Avg merge
4h 57m
Merged PRs (30d)
14

Description

#### 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??

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.