<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Taha Shahzad on Medium]]></title>
        <description><![CDATA[Stories by Taha Shahzad on Medium]]></description>
        <link>https://medium.com/@tahamshahzad?source=rss-2267de1b6b1c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y_5ZcVE6O6AnS1VnqZ8CiA.jpeg</url>
            <title>Stories by Taha Shahzad on Medium</title>
            <link>https://medium.com/@tahamshahzad?source=rss-2267de1b6b1c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:08:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tahamshahzad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Get Ant design import-on-demand working with create-react-app v2 using rescripts.]]></title>
            <link>https://medium.com/@tahamshahzad/get-ant-design-import-on-demand-working-with-create-react-app-v2-using-rescripts-cc822f98f7e5?source=rss-2267de1b6b1c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc822f98f7e5</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[create-react-app]]></category>
            <category><![CDATA[ant-design]]></category>
            <category><![CDATA[fix]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Taha Shahzad]]></dc:creator>
            <pubDate>Mon, 14 Jan 2019 18:46:39 GMT</pubDate>
            <atom:updated>2019-01-14T20:10:35.932Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ICovl5SUtt1kVrrnhJaRAw.png" /></figure><p><a href="https://ant.design/docs/react/use-with-create-react-app#Advanced-Guides"><strong>Advanced guide</strong></a> on ant design website tells us to use <a href="https://github.com/ant-design/babel-plugin-import"><strong>babel-plugin-import</strong></a><strong> </strong>and set it up using <a href="https://github.com/timarney/react-app-rewired"><strong>react-app-rewired</strong></a> (which is basically a tool to override the configuration built into <a href="https://facebook.github.io/create-react-app/"><strong>create-react-app</strong></a>) to import ant design components on demand, but unfortunately the solution did not work on <strong>create-react-app v2.1.3</strong> so I had to dig in to find something dependable. I spent almost an hour coming up with this solution, once I got it working I decided why not write my <strong>first blog post</strong> dedicated to a solution that a lot of people may perhaps be looking for.</p><p>This solution was tested on <strong>create-react-app v2.1.3</strong> with <strong>react-scripts v2.1.3</strong> &amp; <strong>antd v3.12.1.</strong></p><p>We will be using <a href="https://github.com/harrysolovay/rescripts"><strong>rescripts</strong></a><strong> instead of </strong><a href="https://github.com/timarney/react-app-rewired"><strong>react-app-rewired</strong></a><strong> </strong>to get achieve our goal. It’s pretty straight forward, I’ve broken the setup into simple steps, follow the steps and that’s it.</p><h4>1. Initialize create-react-app project directory.</h4><p>Run create-react-app myApp</p><h4>2. Install dependencies.</h4><ol><li>Run command npm i -S antd babel-plugin-import</li><li>Run command npm i -D @rescripts/cli @rescripts/rescript-env</li></ol><h4>3. Create .rescriptsrc.js file.</h4><p>Create a file in root folder named .rescriptsrc.js and add the following content:</p><pre>module.exports = [<br>    [<br>        &quot;use-babel-config&quot;,<br>        {<br>            presets: [&quot;react-app&quot;],<br>            plugins: [<br>                [<br>                    &quot;import&quot;, {<br>                        libraryName: &quot;antd&quot;,<br>                        libraryDirectory: &quot;es&quot;,<br>                        style: &quot;css&quot; // true for less <br>                    }<br>                ]<br>            ]<br>        }<br>    ]<br>];</pre><h4>4. Modify your package.json.</h4><p>Modify the &quot;scripts&quot; field in your package.json to:</p><pre>&quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;rescripts start&quot;, // removed react-scripts<br>    &quot;build&quot;: &quot;rescripts build&quot;, // removed react-scripts<br>    &quot;test&quot;: &quot;rescripts test&quot;,   // removed react-scripts<br>    &quot;eject&quot;: &quot;react-scripts eject&quot;<br>},</pre><p>That’s it. You can now import the antd components without having to import the css files with long syntax. babel-plugin-import will take care of it as we have set that up in our .rescriptsrc.js</p><p>I hope ant design will update the official documentation but anyhow hopefully following the steps I’ve mentioned you’ll be able to get antd working for now. Let me know if this worked for you &amp; any problems that you’re still facing. Until next time! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc822f98f7e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>