Do anyone have a good example on how to have main....
# javascript
g
Do anyone have a good example on how to have main.bundle.js divided into multiple little ones? My app is 5.45MB after minification and it says the optimal size is 244Kb? 😮
r
Do you use DCE?
g
If you need multiple JS files you have to move code to multiple modules, this is the only way how you can compile Kotlin to multiple JS files
Also looks that you bundled everything to a single file, maybe you gave some J's files that may be used separately
g
Yes DCE is applied to the project
g
Does your application is single page?
r
5,5 MB after dce and minification is imo quite large
Have you tried building without dce and/or without minification for comparision? Maybe something is wrong with your configuration?
g
I’ll check that again!
@gildor Its a react app so yes single page. @Robert Jaros So my app is 9.6 MB without dce and 5.45MB with it. Shouldn’t I look for having multiple smaller files so they can all be downloaded in parallel?
r
@galex The biggest of my single page apps is 6,4MB without dce and minification, 3,1MB with minification only, 4MB with dce only and 2MB with minification and dce together. So I would expect slightly better results for your app. You should double check if you really have both tools configured correctly. But of course it could be just a matter of used libraries.
As for splitting the bundle, I have tried using dynamic module loading but failed because of dce bug https://youtrack.jetbrains.com/issue/KT-28523