[BUG] tslog
loads Node.js runtime in a browser environment when used as a transitive dependency
#305
Labels
bug
Something isn't working
Describe the bug
I created a logging library that uses
tslog
under the hood. The library is compiled withtsc
(there's no bundling) and shipped as a CommonJS package. It works well in a Node.js environment, but it fails in the browser with the error:TypeError: (0 , util_1.formatWithOptions) is not a function
.I'm not entirely sure what happens, but I suspect the following
"browser"
entry from tslog'spackage.json
is being ignored:As a result, the Node.js runtime is being used in the browser.
To Reproduce
tslog
.tsc
as a CommonJS module.logger.info()
.Expected behavior
The browser version of tslog should be used, without errors, in browser environments.
Screenshots
None
Additional context
I'm not sure if this is a bug in the library or if it's related to the fact that I'm shipping my module as CommonJS, where
tsc
convertstslog
imports intorequire('tslog')
. If that's the case, please treat this bug report as a support ticket. Thanks!Node.js Version
v18.14.2
OS incl. Version
Any
The text was updated successfully, but these errors were encountered: