cht8687 / react-hover

React hover --- make hover easy http://cht8687.github.io/react-hover/example/
MIT License
107 stars 25 forks source link

Hover Container dependence on child.type breaks behavior when minified #29

Open X-sam opened 5 years ago

X-sam commented 5 years ago

https://github.com/cht8687/react-hover/blob/master/src/ReactHover.js#L45 if child.type is manipulated by uglify or other minifier, hover behavior fails.

cht8687 commented 5 years ago

@stevemao @shineli1984 Any ideas of how to tackle this problem?

stevemao commented 5 years ago

minifier will only change variable names, not object field name. Can you supply any example when it fails?

X-sam commented 5 years ago

Default create-react-app uglify settings are sufficient to reproduce

      uglifyOptions: {
        parse: {
          ecma: 8,
        },
        compress: {
          ecma: 5,
          warnings: false,
          comparisons: false,
        },
        mangle: {
          safari10: true,
        },
        output: {
          ecma: 5,
          comments: false,
          ascii_only: true,
        },
      },
stevemao commented 5 years ago

I may have miss understood your problem. What exactly is the problem? Stating details of what's expected and what's reality should help.

cht8687 commented 5 years ago

@Sam-son This issue seems valid, we need think about a way to preserve the type not being minified.

illiteratewriter commented 3 years ago

@cht8687 I don't think minify is supposed to do that to files in node_modules, so I don't think this is a real issue.