rendinjast / iconsax-react

ICONSAX for React and React Native ✌️
https://iconsax-react.pages.dev/
MIT License
235 stars 31 forks source link

[Critical] Does not work in production build #2

Closed max-frai closed 2 years ago

max-frai commented 2 years ago

Hello, everything is okay in dev build with expo, but when I tried to push app through testflight users it crashes on start. So I started debugging, turned on production mode for expo dev client and found that everything works until I include at least 1 icon. The error in console:

TypeError: can't assign to property "isRequired" on Symbol.for("react.fragment"): not an object

Now I'm trying to find out the exact reason. I also tried empty project with only 1 include of icon and it fails.

max-frai commented 2 years ago

So, just adding import "iconsax-react-native"; at the top of main file broke production build :(. If you don't have expo setup I can help with it together. I'm not sure what's isRequired but I found two lines in dist/index.js related to this property.

max-frai commented 2 years ago

I extracted app bundle script and started searching for isRequired. Here is a one of it's usage near icons code. As I understand, this property shows react that prop is required. Maybe some property forgotten for svg component, for example, during your build process.

 var a = {
      array: e.isRequired = e,
      bool: e,
      func: e,
      number: e,
      object: e,
      string: e,
      symbol: e,
      any: e,
      arrayOf: t,
      element: e,
      elementType: e,
      instanceOf: t,
      node: e,
      objectOf: t,
      oneOf: t,
      oneOfType: t,
      shape: t,
      exact: t,
      checkPropTypes: emptyFunctionWithReset,
      resetWarningCache: emptyFunction
    };
    return a.PropTypes = a;
  };

  propTypes.exports = factoryWithThrowingShims();

  var PropTypes = propTypes.exports,
      _excluded$fw = ["variant", "color", "size"],
      Bold$fw = function Bold$fw(e) {
    e = e.color;
    return React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(Svg.Path, {
      d: "M16.82 2H7.18C5.05 2 3.32 3.74 3.32 5.86v14.09c0 1.8 1.29 2.56 2.87 1.69l4.88-2.71c.52-.29 1.36-.29 1.87 0l4.88 2.71c1.58.88 2.87.12 2.87-1.69V5.86C20.68 3.74 18.95 2 16.82 2Zm-2.32 9.4h-1.75v1.81c0 .41-.34.75-.75.75s-.75-.34-.75-.75V11.4H9.5c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h1.75V8.21c0-.41.34-.75.75-.75s.75.34.75.75V9.9h1.75c.41 0 .75.34.75.75s-.34.75-.75.75Z",
      fill: e
    }));
  },
rendinjast commented 2 years ago

HI. this package is not ready for production mode yet and I did not have access to my computer this month to working on it. After fixing "import all icons" issue, I will work on this problem

rendinjast commented 2 years ago

v0.0.7. there's no error in Prod with expo.

check and if there's any error please share what you did before getting it.