alexeyraspopov / picocolors

The tiniest and the fastest library for terminal output formatting with ANSI colors
ISC License
1.34k stars 44 forks source link

fix: use truthy check for conditional require #75

Closed 43081j closed 1 month ago

43081j commented 3 months ago

~Using globalThis instead of depending on globals means webpack won't complain at being unable to deal with the dynamic require.~

Using a truthiness check seems to solve the problem

Fixes #67

cc @alexeyraspopov maybe we can get a new version published if this lands?

43081j commented 3 months ago

ugh. for whatever reason, this works in node REPL but not when executing a script

ill keep digging

43081j commented 3 months ago

ok for whatever reason, require && require('foo') works in webpack, and require != null && require('foo') doesn't

we could merge this but we should keep a close eye on webpack in future in case they break that too

43081j commented 2 months ago

@alexeyraspopov if we get this over the line, we can publish a new version right?

Anything I can do to help? Would be good to get this moving

43081j commented 1 month ago

@alexeyraspopov I think I can close this since you released a new version

Let me know if it's still a problem though and I'm happy to pick it back up