Joi: 'TextEncoder' is undefined

Created on 25 Nov 2019  路  2Comments  路  Source: sideway/joi

Support plan
which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
is this issue currently blocking your project? (yes/no): no
is this issue affecting a production system? (yes/no): no

Context
node version: 12.13.0.
module version: 16.1.7
environment (e.g. node, browser, native): browser
used with (e.g. hapi application, another framework, standalone, ...):
any other relevant information: -

I am receiving an error regarding 'TextEncoder' coming from joi-browser.min.js when using ie11. Any ideas how to polyfill this?

Capture
Capture2

support

Most helpful comment

I suggest you use: https://github.com/anonyco/FastestSmallestTextEncoderDecoder to polyfill the missing functionality. You can also build your own browser version with some simple changes to the webpack config.

Supporting IE11 makes the bundle much bigger so it was excluded from the list of supported browsers. Can't make everyone happy.

All 2 comments

I run into the same error when trying to generate a coverage report within my vue.js app.

{
  "scripts": {
    "cover": cross-env NODE_ENV=coverage nyc --reporter=lcov --reporter=text npm run test --all,
    ...
  }
  ...
}

Doing the same using @hapi/joi < version 16.0.0 works perfectly.
This issue is probably related to https://github.com/hapijs/joi/issues/2141.

I suggest you use: https://github.com/anonyco/FastestSmallestTextEncoderDecoder to polyfill the missing functionality. You can also build your own browser version with some simple changes to the webpack config.

Supporting IE11 makes the bundle much bigger so it was excluded from the list of supported browsers. Can't make everyone happy.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesdixon picture jamesdixon  路  4Comments

alekbarszczewski picture alekbarszczewski  路  3Comments

REBELinBLUE picture REBELinBLUE  路  3Comments

kevbook picture kevbook  路  4Comments

a-c-m picture a-c-m  路  3Comments