m4ss1m0g / mediatr-ts

Mediator patter for Typescript, inspired to MediatR csharp library
MIT License
45 stars 9 forks source link

Issues with js-minifier? #23

Open phunguyen-finn opened 7 months ago

phunguyen-finn commented 7 months ago

Since you're using class name as key, it can get pretty messed up going through a JS minifier, am I right? I got a case where in dev it goes ok, then I published it for production and it got an errors where two handler classes ended up having the same name.

m4ss1m0g commented 7 months ago

I'm working on a possible solution (see the className branch). Can you provide a minimal example or you can try the dev branch?

thachp-mhc commented 4 months ago

Is there an update on this issue? I potentially have a similar bug where I expected handler X to be called, but instead handler Y was executed. I can't reproduce it in development, but it does occur in production.

m4ss1m0g commented 4 months ago

I publish a beta version 1.3.0-beta.1 where you can specify a name for the className.

thachp-mhc commented 4 months ago

Thanks. It seems to be working. I'm not sure how to verify this, except that after minification, I can no longer reproduce the errors that I was having.

Is there an implicit way to implement this without having to explicitly define the unique ID in both the decorator and the request class?

m4ss1m0g commented 4 months ago

Is there an implicit way to implement this without having to explicitly define the unique ID in both the decorator and the request class?

I'm open to suggestions ;-)