Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Assets Faster ! #232

Closed
nimaa77 opened this issue Aug 17, 2019 · 5 comments
Closed

Load Assets Faster ! #232

nimaa77 opened this issue Aug 17, 2019 · 5 comments

Comments

@nimaa77
Copy link
Collaborator

nimaa77 commented Aug 17, 2019

Feature, And need some Help!

Current Behavior

After.js only send the main CSS and js files from server then on browser at ensureReady method it tries to fetch javascript and CSS files for the current code spilled page. it's too slow (even Google PageSpeed Insights warns about it)

Desired Behavior

Send all CSS and JS needed for the current route from the server.

Suggested Solutions

I maid a little library that fixes this problem but I'm not sure about new routes config file, it's little complicated and it's bad for DX (or maybe it's not, let me know), I need some help about routes and this, more information on afterjs-assets repo, if you think it's ok i can write tests and make PR.

you can install and use the package from npm registry till the day PR get merged.


  • After.js Version: 1.3.1
  • Razzle Version: not sure 2.4.1 or 3.0.0
  • React Version: 16.9.0
  • TypeScript Version: 3.5
  • OS:
  • Node Version:
  • Package Manager and Version:
  • Demo Repo or Link: https://github.com/nimacsoft/afterjs-assets
@nimaa77
Copy link
Collaborator Author

nimaa77 commented Aug 17, 2019

@jaredpalmer what's your idea?
all of this become possible after reading this comment.

@s123121
Copy link

s123121 commented Aug 27, 2019

Just wanna clarify, I am in the process of optimizing speed for my after.js app. When you talk about ensureReady make the app too slow, are you talking about TTFB?
https://web.dev/time-to-first-byte/

@nimaa77
Copy link
Collaborator Author

nimaa77 commented Aug 27, 2019

@s123121
short answer: no.
TTFB is about server-side (i meanserver.js file) but ensureready get called on the browser and have nothing to do with TTFB.

in order to have a better TTFB you can use cache for HTTP requests in getInitalProps method or cache the server response with a package called cacheable-response.

read this too: Rendering On The Web

this issue is not about code execution performance. it's about making js and CSS files downloaded faster to get executed later.

@nimaa77
Copy link
Collaborator Author

nimaa77 commented Sep 10, 2019

nobody helped and I learned many new things, check #237.

@nimaa77 nimaa77 closed this as completed Sep 10, 2019
@nimaa77 nimaa77 mentioned this issue Jan 20, 2020
67 tasks
@nimaa77 nimaa77 reopened this Jan 20, 2020
@nimaa77
Copy link
Collaborator Author

nimaa77 commented Mar 9, 2020

MERGED 🎈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants