dapi-labs / react-nice-avatar

react library for generating avatar
https://nice-avatar.wwayne.com
MIT License
1.05k stars 88 forks source link

Library does not work in production #30

Closed rhuangabrielsantos closed 2 years ago

rhuangabrielsantos commented 2 years ago

My Code:

import Avatar, { AvatarFullConfig, genConfig } from 'react-nice-avatar'

{...}

const [firstPlayerAvatar, setFirstPlayerAvatar] = useState<AvatarFullConfig>({})

useEffect(() => {
    setFirstPlayerAvatar(
      genConfig({
        bgColor: 'transparent',
      })
    )
  }, [])

{...}

 <Avatar
    {...firstPlayerAvatar}
    style={{ width: '7rem', height: '7rem' }}
 />

{...}

On localhost it works image

In production it doesn't work, error message: image

Uncaught Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=object&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

full code: https://github.com/rhuangabrielsantos/dots-game production: https://dots-game.vercel.app/

I use vite with reactjs

Help me :(

rhuangabrielsantos commented 2 years ago

I fixed this problem, changed the vite to react-scripts

https://github.com/rhuangabrielsantos/dots-game/pull/1

a5006 commented 1 year ago

I'm curious why it doesn't work in Vite?

a5006 commented 1 year ago

hey bro ,I fixed this problem too ,but I did not change vite to react-scripts , here is my package.json: "devDependencies": { "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-react": "^4.0.3", "eslint": "^8.45.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", "typescript": "^5.0.2", "vite": "^4.4.5" }