I have created a sample react app from createapp.dev and added antd in the package.json.
I have been playing around with the table component from antd, and all worked fine when running locally. My snippet looks like this:
import React from 'react';
import {Table} from "antd";
export default class App extends React.Component {
render() {
return(
<div>
<div>Table</div>
<Table dataSource={[]} columns={[]} />
</div>
)
}
}
And the package.json is this:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"scripts": {
"clean": "rm dist/bundle.js",
"start": "parcel src/index.html",
"build": "parcel build src/index.html"
},
"dependencies": {
"antd": "^4.8.2",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
"devDependencies": {
"parcel-bundler": "^1.12.4",
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1"
}
}
Then after running yarn build command it successfully generates the build, but when serving the production build, it breaks with errors like TypeError: s is not a function which comes from Header component of rc-table.
I've searched for a workaround and but wasn't able to find a solution. Does that mean we can't use Table component from antd and why is this issue not detected when running the production build? Has anyone encountered a similar issue?
Edit: Found an online demo with a similar issue