Changing imports to reduce bundle size?
See original GitHub issueI just spent a couple hours tonight trying to figure out why my import on demand per Ant’s docs was not working. Turns out that it was a couple imports from formik-antd.
I wonder if it’s possible for formik-antd to import similarly, e.g. instead of import { Form } from 'antd' you would do import Form from 'antd/lib/form' or import Form from 'antd/es/form'.
Thanks in advance!
Issue Analytics
- State:
- Created 4 years ago
- Comments:40 (24 by maintainers)
Top Results From Across the Web
Correctly Use Javascript's Imports To Improve Bundle Size
Importing libraries incorrectly will rapidly increase your bundle size, increase your build time and will make the user eventually wait more ...
Read more >Everything you can do to reduce bundle size for webapps
Web bundlers such as Webpack are a great tool to deploy web apps, but for more complex programs, bundle size can quickly become...
Read more >5 Methods to Reduce JavaScript Bundle Size - Bits and Pieces
5 Methods to Reduce JavaScript Bundle Size · 1. Code Splitting with Webpack · 2. Using Webpack Plugins for Tree Shaking · 3....
Read more >Reduce JS Bundle Size by Dynamically Importing es6 Modules
One way to reduce JavaScript bundle size is to dynamically import es6 modules which are not required for the initial loading of the...
Read more >4 Ways to Shrink Your Javascript Bundle by 50% - Riley Shenk
4 Ways to Shrink Your Javascript Bundle by 50% · 1. Ignore moment.js locales · 2. Directly import lodash functions you need. ·...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I found the problem. This library has
"sideEffects": falsewhereas ant design hasMarking all files as side effect free tells webpack to shake off files that have no used tokens (this happens for styles). I will send a PR now.
This is my
babel-plugin-importconfig:So my suggestion is to use same filename style with
antd, and include style entry file, which looks like this:style/index.jsandstyle/css.jsjust importantd/lib/xxx/styleandantd/lib/xxx/style/css.jsAfter doing that, we can use a simple
babel-plugin-importconfig:@jannikbuschke