You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The readme claims browser support; however it seems this is a bit of a bait-and-switch. The .browser.js version does nothing and is hardcoded for every function just to return strings unchanged. Looking through the previous issues I understand the reasoning for this, which is to support certain bundlers which were throwing errors.
Working version
Here is a picocolors.ts that works in the Chrome dev console. The only thing I've changed is to delete the isColorSupported function at the top which uses the Node tty module. Also I converted it to Typescript so I can easily move it between projects in a single file.
Browser support means bundlers don't break if you accidentally ship this package to a browser. The suggested implementation only works in Chrome, which is not the Web. I'm happy to revisit this when Safari and Firefox support this too.
The readme claims browser support; however it seems this is a bit of a bait-and-switch. The
.browser.js
version does nothing and is hardcoded for every function just to return strings unchanged. Looking through the previous issues I understand the reasoning for this, which is to support certain bundlers which were throwing errors.Working version
Here is a
picocolors.ts
that works in the Chrome dev console. The only thing I've changed is to delete theisColorSupported
function at the top which uses the Nodetty
module. Also I converted it to Typescript so I can easily move it between projects in a single file.I would happily open a PR to replace the stub version with this (or the JS equivalent), assuming this project is not abandoned...
The text was updated successfully, but these errors were encountered: