Closed aleffert closed 5 years ago
That's weird. It should not be required. Can you put out repro repository somewhere with webpack config etc. so I can take a look?
Thanks for your kind words!
If you have two reducer classes in different files the minifier might indeed generate same names for them during the name mangling but that case should be handled by the duplicate name detection:
This happens also when you dynamically generate reducer classes by returning them from a function.
Not sure why this is not working for you.
I didn't have time to pull out an example, but I think I figured out the problem. It looks like the dedupe protection is all in createReducers
? I was calling createActions
first. When I swap the order so createReducers
is first, the problem goes away. This makes sense, since the dedupe protection would actually change the customName
after I've made the action creators and they'd no longer match.
Oh that makes sense because createReducerFunction()
actually mutates the classes by setting the customName
automatically if it finds colliding class names.
Fix released in 0.2.1. Thanks for reporting!
I set up a new project using create react app and everything worked fine in dev, but when I did a production build, my actions mysteriously weren't executing. I was able to solve this problem by setting a
customName
on my class. Also some wonky stuff was going on with class names (they all seemed to bet
) when I went to debug so I am pretty sure it was a minification problem.It'd probably be good to document that you pretty much need to set up customName if you're using a minifier (or figure out some clever way around this).
p.s. this library was pretty much exactly what I was looking for. Thanks!