toboid / correlation-id

Correlation id for node.js
MIT License
47 stars 8 forks source link

ESM compatible library version? #59

Closed redevill closed 1 year ago

redevill commented 1 year ago

Any chance of an ESM (vs Common JS) compatible version?

Without this ESM, 'correlation-id'. CommonJS or AMD dependencies can cause optimization bailouts Not straightforward to make it work - Special polyfills needed.

toboid commented 1 year ago

Hi, thanks for raising this. Yes sure, we can add ESM support. Could you expand a bit on what toolset you are using? For example does this occur when bundling? If so which bundler?

redevill commented 1 year ago

Express, Log4js, Typescript - need to double check on the bundling, as my environment manages both client and server side at the same time.

redevill commented 1 year ago

(Well (embarrassed look here) - my issues/errors were related to my Client side code picking up my logging class as a dependency.) This resulted in the original posted error, coming from webpack.

While an ESM compatible may still be useful for others, I am not bundling on my server... YET :) and the following works to hold the linter at bay: import * as correlator from 'correlation-id';

toboid commented 1 year ago

Thanks for the update. I agree that native would still be a useful addition