Closed AndreyShpilevoy closed 7 years ago
I haven't looked into it too much, but I believe the issue is that you're not using true functions for your components, but are using anonymous functions, like so:
const Container = ({ fluid, children, classNames }) =>
When Uglify is ran, I'm assuming this get's converted to something like const a = () =>
, which is causing the duplicate style objects. I'd suggest using true functions, or passing a styleName
to the styler function.
Thank you for the fast reply. I tried to change my arrow functions to named functions but got the same result. Unfortunately, the problem wasn't solved.
Changed version on my repo btw.
I also changed all those components from stateless to stateful - and even that didn't solve the problem with UglifyJsPlugin .
Weird. Looking into it a bit more.
Messed around with this a bit, the problem resolves itself if you pass mangle: false
to the uglify configuration or if you use options.styleName
. http://lisperator.net/uglifyjs/mangle
This is definitely a tricky situation to solve. I can probably generate a UID in production.
Yep, if pass mangle: false
to the uglify configuration really solved this issue.
But it increased bundled files size average in 51,5%.
So it's definitely a workaround.
I will wait for your fix this problem. Huge thank you for your time and great work.
Thanks for finding the issue. Definitely something that should be fixed.
Will most likely go with the UID approach. Just need to avoid collisions.
@AndreyShpilevoy I published a small patch, let me know if that works for you.
Thank you! It's really working. Even with stateless arrow functions.
Sweet. 👍
First of all, thank you for this awesome package. It's really cool package.
I use HOC for 4 my components, it's work as expected in development mode. When I build project in production mode - 2 components receive the classNames object for property from another component.
If I disable webpack.optimize.UglifyJsPlugin from the production build - it also works as expected.
Link to my rep: https://github.com/AndreyShpilevoy/DemUiBoilerplate/tree/master/DEM_MVC_UI I trying to create Bootstrap-like grid on jss with theme support.