hapijs / hapijs/joi

Change browser module export

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

Description

#### Context

* *node version*: 12.12.0
* *module version*: 17.1.0

#### What are you trying to achieve or the steps to reproduce ?

The documentation does not make it clear how `@hapi/joi/dist/joi-browser.min.js` can be imported and used like regular `@hapi/joi`. I am trying to use `Joi` in `Karma`.

```js
// --- What I've tried:
import Joi from '@hapi/joi/dist/joi-browser.min.js';
import * as Joi from '@hapi/joi/dist/joi-browser.min.js';
import '@hapi/joi/dist/joi-browser.min.js';
import { Joi } from '@hapi/joi/dist/joi-browser.min.js';
// ---

export const createSchema = () => {
return {
scoresStore: {
scores: Joi.array().length(4).items(Joi.number().equal(0)).required()
},
overallScoreStore: {
root: Joi.object().required(),
overallScore: Joi.number().equal(0),
overallScoreTwo: Joi.number().equal(0)
}
};
};
```

Could someone tell me what the issue is here?

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.