Skip to content

Commit

Permalink
fix: ensure no warnings when bundled (#50)
Browse files Browse the repository at this point in the history
* fix: ensure no warnings when bundled

node "util" is now mapped to an empty object and checked in runtime.

addresses chaijs/chai#1447

* style: lint fixes

Co-authored-by: Keith Cirkel <[email protected]>
  • Loading branch information
AviVahl and keithamus authored Jan 26, 2022
1 parent 924cafe commit 30e1ac7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const chaiInspect = symbolsSupported ? Symbol.for('chai/inspect') : '@@chai/insp
let nodeInspect = false
try {
// eslint-disable-next-line global-require
nodeInspect = require('util').inspect.custom
const nodeUtil = require('util')
nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false
} catch (noNodeInspect) {
nodeInspect = false
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
],
"main": "./loupe.js",
"module": "./index.js",
"browser": {
"util": false
},
"repository": {
"type": "git",
"url": "https://github.com/chaijs/loupe"
Expand Down

0 comments on commit 30e1ac7

Please sign in to comment.