hasanayan / craco-module-federation

Enable Module Federation on your CRA project without ejecting or losing update support of react-scripts
MIT License
51 stars 19 forks source link

Fix: Multiple assets emit different content to the same filename #5

Closed ghost closed 2 years ago

ghost commented 2 years ago

This PR fix the error "Multiple assets emit different content to the same filename" when attempt to implement a workaround to have shared context value.

An example of this can be founded in shared-routing and the explanation related to it can be founded here.

I made it optional as an optional param, respecting the same API design. I'm not well-versed in webpack so I'm not sure if both options (chunkIds and chunkFilename) are conflituos. Any feedback on this are appreciated.

hasanayan commented 2 years ago

Hi @victorseara, I appreciate you taking the initiative to fix the problem you mentioned but your solution has side effects. You a re forcing (of course if enabled in the configuration) a specific filename pattern and making filenames include chunk names which is something some consumers would not want to expose to the public.

I would like people who run into this problem to fix this by doing the changes you are suggesting in their craco.config.js files using the filename pattern they wish to have. In fact, they can go further and develop another craco plugin that does this. Please have a look at documentation of craco at https://github.com/gsoft-inc/craco

ghost commented 2 years ago

I absolutly agree with you. I didn't know about the side effect you mentioned. Thank you for clarifying it to me. I'll fix that in my craco.config and close this pr.

Thank you again for guiding me in the right direction!