Coder Social home page Coder Social logo

Comments (2)

doowb avatar doowb commented on July 23, 2024

Is there a way to add the polyfill?

This issue may be related and might get fixed in create-react-app.

from ansi-colors.

eddie-dunn avatar eddie-dunn commented on July 23, 2024

Not sure, I haven't had the time to look into it much. Here's an answer on Stack Overflow: https://stackoverflow.com/a/65018686/955014

A simpler solution could be to just wrap the assignments of isWindows and isLinux in a try-catch, where you default to something sensible on error.

Though as I see it, I'm not sure querying process.platform and then hardcoding the behavior based on that is the best solution. For example, the reason I'm using ansi-colors in a web app is for communication with an external device via the Web Serial API. In that regard, process.platform is not useful at all, since it only applies to the host OS, not the one being communicated with. A solution where it's possible to configure the lib during runtime whether it should use Windows or Linux ANSI seems a lot more flexible to me.

Or, perhaps web and ANSI-colored text streams from external devices is not something you wish to support, which is fine too, and then I suppose you can leave it as is :)

from ansi-colors.

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.