Code Monkey home page Code Monkey logo

Comments (6)

isaacs avatar isaacs commented on July 19, 2024 3

@udarrr Trust me, I am fully aware of what packages are being used.

Jackspeak depends on @isaacs/cliui, which depends on:

    "strip-ansi": "^7.0.1",
    "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",

What this does is that it tells npm (or any package manager that understands this syntax, which has been in npm for a very long time at this point, dating back to npm version 4, iirc) to install the version 7 of strip-ansi in node_modules/strip-ansi, and install version 6 of strip-ansi in node_modules/strip-ansi-cjs.

At run time, the cjs implementation of @isaacs/cliui does this, in `build/index.cjs':

const stripAnsi = require('strip-ansi-cjs')

and the ESM implementation in index.mjs does this:

import stripAnsi from 'strip-ansi'

The module that gets loaded depends on whether you use import or require to load it, by referencing the package.json's exports field:

{
  "exports": {
    ".": [
      {
        "import": "./index.mjs",
        "require": "./build/index.cjs"
      },
      "./build/index.cjs"
    ]
  }
}

This works with CommonJS, and it works with ESM, provided that you are using a package manager that is up to date and complete, and a node version since node 12.

That's why I asked, what are you installing and running it with?

Because I think you are using a broken package manager, and that is the problem. Usually when people report these sorts of problems, it's because they are using yarn version 1. If that's what you're using, I suggest you stop doing that.

from node-glob.

isaacs avatar isaacs commented on July 19, 2024

Can you clarify what is breaking and in which contexts?

I use glob 10 in many commonjs modules, it works fine.

from node-glob.

udarrr avatar udarrr commented on July 19, 2024

Yes @isaacs sure, generally it's because of strip-ansi 7.0.1 it's ESM currently. Dependencies from top to bottom are glob->jackspeak->@isaacs/cliui->strip-ansi.
Yes it works with version 10 but not with the latest

from node-glob.

isaacs avatar isaacs commented on July 19, 2024

What are you installing/running with? It works with node and npm.

from node-glob.

udarrr avatar udarrr commented on July 19, 2024

Let my explain. One of your dependency is being used strip-ansi since version 7.0.0 has been converted to ESM chalk/strip-ansi@7cda68d the dependency has been included to @isaacs/cliui. It's some kind of breaking changes and can't be used for packages with commonjs approach.

from node-glob.

udarrr avatar udarrr commented on July 19, 2024

Hi @isaacs yes you are right... Thank you for the clarification!

from node-glob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.