fullstack-build / tslog

📝 tslog - Universal Logger for TypeScript and JavaScript
https://tslog.js.org
MIT License
1.35k stars 63 forks source link

Setting up Tslog in webpack #223

Open franjom opened 1 year ago

franjom commented 1 year ago

Can someone please help me set tslog in webpack? I set in my webpack.config inline source maps like this: image

and in my tsconfig: image

but all of my logs are undefined... output is nothing like it's supposed to be:

image

Any advice is appreciated. Thanks in advance

dever23b commented 1 year ago

Not sure if this is helpful, but posting here just in case. I'm having a similar issue and, while I haven't figured it out yet, I came across this issue while researching. I'm also experiencing empty stack traces. From what I've gathered so far, TSLog doesn't seem to be able to handle file paths containing parentheses. Since it doesn't expect them, when it encounters them, it discards the data from the trace.

My project uses NextJS; the Webpack bundle produced includes paths containing parentheses (example trace line: (webpack-internal:///(sc_server)/./src/server/services/auth.service.ts:36:26)). This code seems to be the culprit. The regex causes fulllFilePath to be incomplete, and the following logic eventually discards the line. As a result, all of my browser code ends up with blank traces.

I don't have a workaround figured out yet, but hopefully this might spark an idea from someone else.

Edit: Created an issue #240 for my findings specifically