So i decided to use react, and antd on top of it. thought would be kinda cool. I am packing everything with webpack and my bundle size is about 2.8 megabytes Carl!
Even if i import a tiny checkbox from antd it is still the same bundle size. It imports whole antd in to a project. my assumption is that it shouldn't do it.
i used babel-import-plugin and it did reduce bundle size to 2.3 megabytes but in real world it is still not acceptable.
import React from 'react';
import ReactDOM from 'react-dom';
import {Checkbox} from 'antd';
import 'antd/dist/antd.less';
class HelloWorld extends React.Component{
render(){
return (
<h1>Hello React</h1>
)
}
}
function trig(){
console.log("Changed");
}
ReactDOM.render(<Checkbox onChange={trig}>Click Me</Checkbox>, document.getElementById("app"));
So just to make this it takes 2.3 megabytes of code ?
.babelrc
{
"plugins": [
["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }]
// `style: true` for less
]
}
Update, With no antd my react bundle is only 118kb