Skip to content

Remove the need for require ('util') in browser environment #718

@majkelch

Description

@majkelch

I would like to use Sanctuary with Vue 3.x (Composition API), Vite (2.6.x) and Yarn 3.x. Vite runs without problem, but when navigating to any page, I am running into error from Either/index.js:

var custom = util.inspect.custom; TypeError: Cannot read properties of undefined (reading 'custom')

My usage of Sanctuary looks like this api.utils.js:

import * as S from 'sanctuary'
export const processData = ({ data }) => S.pipe ([ S.head, S.props(['value', 'result']) ]) (data.rows)

From our discussion on glitter, recommended solution would be:
The long-term fix is to update Sanctuary to use Symbol.for ('nodejs.util.inspect.custom'), obviating the need for require ('util'), circumventing this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions