fix: make sur it works in browser where tty package isnt available#64
fix: make sur it works in browser where tty package isnt available#64WNemencha wants to merge 1 commit into
Conversation
|
I'm curious. How are you using Colorette in the browser? |
|
It's used in our dependencies by some tools (postcss i guess) and postcss is used by sanitize-html, which we do use to sanitize markdown ^^. The fact that its here in the bundle was throwing like: PS: I hope this message does not feels harsh, whishing u a great evening ;) |
|
Shouldn't this be handled by your bundler or compiler? |
|
@jorgebucaran How can webpack handle Node context not being there? |
|
I really don't know. What about a global shim? Colorette shouldn't be in the OP's bundle to start with. |
|
SSR is one possible option. Serverless is another. |
|
Agree with @kibertoad, that's just a branch, and branches are cheap. Configuration of bundle processor in the other side isn't about branches, thus costly ^^ |
|
@WNemencha I wonder why additional check is necessary, though. Wouldn't tty be undefined already? Also is 'process' available? I would expect that to fail too. |
|
@kibertoad The |
|
@WNemencha This is exactly #67 Proposal: tty?.isatty?.(1)This works even if bundlers proxy / mock the module but not the function. (e.g. in |
Do you mean bundlers add special support for this? I'm not aware of any |
No description provided.