Search code examples
reactjscreate-react-appyarnpkgantd

Yarn build failed with Ant Design


I was going to redeploy a web app, so I was trying to run yarn build, and it runs into this error.

I am using Ant Design, I also did a yarn eject before, after a search through google still no luck, any encountered this is an error before? Any tips on solving it? thanks!

yarn run v1.22.0
$ react-app-rewired build
Creating an optimized production build...
Failed to compile.

./node_modules/antd/es/style/index.less
TypeError: this[MODULE_TYPE] is not a function


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Solution

  • Even I faced the same issue. My problem was I mixed up with Ant Design versions. Ant v4.x was released recently, so I used components without checking the version. So, try using components of same version and see if it works!!.