ant-design: Compile error with Webpack 5 after upgrading but working good with Webpack 4.4.1

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://github.com/khanakia/antd-webpack5-error.git

Steps to reproduce

git clone https://github.com/khanakia/antd-webpack5-error.git npm install npm run start

What is expected?

Should compile successfully in dist directory

What is actually happening?

Getting Babel errors

ERROR in ./node_modules/@babel/runtime/helpers/esm/createSuper.js 1:0-46
Module not found: Error: Can't resolve './getPrototypeOf' in '/Volumes/D/www/js/jeoga_app/basic_webpack/node_modules/@babel/runtime/helpers/esm'
 @ ./node_modules/rc-tree-select/es/TreeSelect.js 4:0-66 445:15-27
 @ ./node_modules/rc-tree-select/es/index.js 1:0-38 5:15-25
 @ ./node_modules/antd/es/tree-select/index.js 8:0-91 86:48-60 142:22-30 143:22-30 144:25-36 145:24-34 151:0-20
 @ ./node_modules/antd/es/index.js 59:0-54 59:0-54
 @ ./src/index.tsx 3:13-28

..............
Screenshot 2020-09-12 at 8 49 12 PM
Environment Info
antd 4.6.3
React 16.13.1
System OSX
Browser Chrome

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 43 (6 by maintainers)

Most upvoted comments

@khanakia, Check the repo and also same @babel/runtime@7.11.2. Seems we can do nothing on antd side. You can report bug to webpack about current beta version. Thanks.

yarn cache clean yarn install

don’t forgot yarn add @babel/runtime

using babel/runtime": "^7.12.5" together with yarn resolutions setting, did the trick for me:

"resolutions": {
    "@babel/runtime": "^7.12.5"
  },

https://github.com/webpack/webpack/issues/11467#issuecomment-727014123

Don’t forget to remove and reinstall node_modules.

webpack don’t use the beta.30 version, I’m currently locked beta.24 can work. https://github.com/webpack/webpack/issues/11467