Very heavy bundle size of react development website - performance

I am creating a react website. Its almost ready but when I am debugging it, its load time is 1.2 Minutes and bundle size is 28 MB.
I have tried following solutions without success so far:
https://medium.com/#rajaraodv/two-quick-ways-to-reduce-react-apps-size-in-production-82226605771a#.qfpspcha4
https://hackernoon.com/optimising-your-application-bundle-size-with-webpack-e85b00bab579#.t3vabgy27
How to minimize the size of webpack's bundle?

Did you try changing your devtool setting? I believe inline-source-map is the reason for the large file size. More info on the different devtool settings here. For production I personally use devtool:'cheap-module-source-map' and have great success with it. I hope this help some, webpack can sure be frustrating at times.
Also to have a lighter dev build I would suggest to use devtool:'eval', It's probably the most efficient as far as development goes.

Related

How to increase the load time of a Ionic4 project when initial render?

For my project, I have used Ionic with Angular. When my ionic project first renders then the load time was too slow. This problem occurs because when the project first renders then it takes time to load all the js files. So how I can load the 'js' file faster which will increase the load performance of my ionic project. If anyone knows the better reason why the load time is that much slower then please tell me the reason and the solution.
Because you are running in debug mode
in debug mode load time will be 7-8 secs
in prod mode it will be reduced to 4-5 secs
Also need to follow good practices while coding
Try to follow these links and tools in the link Angular Performance Checklist

Angular 2 is slow to initialize

can anybody help me?
My Angular 2 application is taking a long time to initialize.
There are only 16 requests.
And despite the relatively high size of 3 mb, the problem is not to bring the files.
I'm referring to the time after getting all files.
On my notebook are 3 to 4 seconds, which I believe is a high time since I have only 10 components, 1 pipe, and 6 directives for now.
The idea is that the application has close to 200 components.
Then I will create lazy loading.
But for 10 components I think it should be faster.
On the cell phone the standby time reaches 10, 12 seconds.
On the iPad the wait is relatively large as well.
Above 15 seconds.
I am using webpack, minifying css and js.
Even using pre-render on the server (asp.net core).
This delay occurs after all files are downloaded.
That is, it is an angular 2 processing time to render the screen.
What else could I do?
What could I have done wrong?
The test link:
http://projetos.codegenerator.com.br/angular2/
Thanks.
I think you are not using any bundle tools like webpack, systemjs..
When you deploy your ng2-app, you should use AOT(ahead of time) compile.
I guess you are using JIT(just in time) compile.
In angular2 guide page,
With AOT, the browser downloads a pre-compiled version of the application. The browser loads executable code so it can render the application immediately, without waiting to compile the app first.
When you use JIT compile, your browser will download vendor.js which is defined by angular2 compiler and it will compile your app just in time. It will be too slow and your client have to download vendor file. When you use AOT, you dont have to use vendor file, so resources are being smaller.
I recommend to use AOT compile when you deploy your app, and use lazy loading for resource size.
If you are curious about ng2 AOT compile, read this guide.
angualar2-cookbook-AOT
And here is example angular2 app with webpack2 and lazy load.
use file structure and config files in here.
When I tested with example app, files bundled with aot was smaller than 500KB.
angular2-webpack2-aot
Angular 2 is well tested for its performance, If there is anything lagging its on the application and its dependencies..
Check your environment, If there are only few component then there is nothing wrong on the framework side.
Webpack or any other build tools has nothing to do with the performance , coz they are development dependencies,
If you are using cdn's for some third party services or libraries, check whether their services are on time.
I finally got the performance I wanted in the application.
It took a bit of work but really worth it.
Configure your application to compile in AOT, really the performance gain is worth it.

Is there a way to make Browserify faster?

I'm using Browserify with Gulp in my front-end environment. Recently I'm using watchify also, and it has magnificently improves of bundling speed. However it still pretty slow on first bundling, it takes about 10~13 seconds in my computer.
Common modules are bundled seperately with named vendor.js, but not much change. Once I used Webpack on different project, and it was super fast and I was quite suprising. I really love using Browserify and think that there must be a way to faster than now.
Is there a something to browserify faster than now? I'm not expecting faster as Webpack, just, you know, 10~13 is long long time, so I want to reduce it as possible as I can. Any advice will be very appreciate!
I solved by intergrating with Persistify, which saves latest bundle data to the disk, so you can run much more faster everytime you restarted the task.
But it still slows at first time XD

Heroku timeout with custom Buildpack

I have a custom Heroku Buildpack that compiles CMake and OpenCV. The problem is, OpenCV takes FOREVER to compile. I've tried precompiling OpenCV and pulling it in during my build; however, I have not yet been successful in doing so.
I recently came across the COMPILE_TIMEOUT=n env variable that can be set to override the 15 minute timeout, but it's not working. Does anyone know if this env is still supported? Or if there is another approach besides precompiling?
I would ideally like to have the flexibility of compiling on the fly if I update to the latest version of OpenCV (compilations are cached on Heroku so I'm not waiting around for a full build on every deploy).
I think your best shot would be to build your binaries beforehand. However, Heroku still doesn't have great support for this.
See these links for some suggestions:
https://discussion.heroku.com/t/compiling-a-custom-binary-for-buildpack/224
https://discussion.heroku.com/t/opencv-and-statically-compiled-python/105
Pre-compiling binaries is the way to go; however, it requires time and effort that I'd rather avoid. I reached out to Heroku and they were willing to increase our build time to 30 minutes. Unfortunately, 30 minutes was still not enough to compile OpenCV. The Heroku team was kind enough to Anvil which happens to be the same build service that runs on Heroku. Looks promising!
https://github.com/ddollar/heroku-anvil

Why does meteorite take so long to load? 1.2 MB

Why does the first load of my meteorite site take so long to load? (www.jasperlu.com). It seems like most of the loading time is being taken up loading .map files or sockets. Is there a way to speed this up tremendously?
You're not using your site in production mode. Remember you should bundle your project up and not just use meteor to get it running. Using meteor is for development only.
See https://www.eventedmind.com/feed/okpzbuNSspDf6tPiy for a screencast on how to do this step by step.

Resources