datalust / seq-logging

A Node.js client for the Seq HTTP ingestion API
Apache License 2.0
25 stars 15 forks source link

Finish pr #65

Closed liammclennan closed 1 year ago

liammclennan commented 1 year ago

Makes seq-logging work in the browser without having to polyfill node modules.

Drops support for node 12 and therefore bumps the version of this package to 2.0.0.

u-rogel commented 1 year ago

Hi, thanks for moving on with this topic! I came across an issue that webpack is still trying to resolve the three required polyfills for the older nodejs versions. While it does work, and I can add to webpack configs to ignore those requires, I think it is only half achieving the goal. Do you think we can still do some iterations to see if it can be achieved without the need to configure webpack for it?

signal-2023-05-02-125430

liammclennan commented 1 year ago

Hi @u-rogel

That looks like how Webpack have chosen to deal with optionally required modules. I'd love a better solution. What do you propose?

u-rogel commented 1 year ago

It is some time since I tried it but I remember webpack had an option for conditional compiling plugin. If it is still available we can create two bundles, one for node one for browser. Then we need to specify that the module is exporting two bundles one for node and one default (browser) and then webpack or rollup will pick up automatically the right bundle.

Can you also give it a try if you find this webpack plugin for conditional compile time?

liammclennan commented 1 year ago

@u-rogel I'm happy to help, but I don't understand what you mean. seq-logging doesn't use webpack so where would the config go?

u-rogel commented 1 year ago

I think we would need to introduce webpack or rollup in order to achieve it