Skip to content

Unmaintained depency @jsdevtools/ono causing issues #63

Description

@Misfits09

When using @stoplightio/elements with Vite.js it is not possible to build the because of the unmaintained @jsdevtools/ono. I figured it should be replaced by a more fitting alternative.

Current Behavior

When building elements with vite, I get the error can't convert undefined to object coming from these lines in "@jsdevtools/ono" bundles:

// CommonJS default export hack
if (typeof module === "object" && typeof module.exports === "object") {
    module.exports = Object.assign(module.exports.default, module.exports);
}

Expected Behavior

Use a maintained repository from error handling

Possible Workaround/Solution

Only solution is to replace this dependency by an empty one in Vite config but that could cause some issues... As I described here

Steps to Reproduce

  1. Create a vite App from scratch
  2. Install @stoplight/elements to the project
  3. Add nodePolyfills with plugin vite-plugin-node-polyfills
  4. Add commonjsOptions: { transformMixedEsModules: true } build option
  5. Install prismjs and add import 'prismjs'; at the top of main.tsx
  6. Try running npm run build or yarn build

Environment

Latest version of elements with @stoplight/json-schema-ref-parser@"^9.2.7"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions