-
Notifications
You must be signed in to change notification settings - Fork 235
feat(ssr-perf-check): check whether server side rendering is used #904
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
base: main
Are you sure you want to change the base?
feat(ssr-perf-check): check whether server side rendering is used #904
Conversation
asollberger
commented
Jul 22, 2025
- performance gain by not bundling for the server when ssr is not in use
- performance gain by not bundling for the server when ssr is not in use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea but this seems more like a half-fix.
The packages are only being compiled if the platform is "node". Therefore, hypothetically it shouldnt compile dependencies if they're not marked as "node" in the first place.
An ideal solution would be to switch to a general "node" or "browser" platform in the federation.config.js to choose if all packages should be compiled as node or browser.
Let me know what you think.
I'm not sure I fully understand your comment. The way I understand the four builds is that, when you run a simple frontend build, you only need to compile the browser part, when you're running both frontend and backend (server side rendering), you need to run the browser and the node build. I have not used the SSR build at all yet, so I'm not as familiar witth it. |
Thank you for your comment, In the build angular process, the splitShared function creates 4 groups of dependencies based on if they're marked as My first pointSince in a non-ssr setup such as yours, the "sharedServer" object is empty , (because there are no node packages, you can check the splitShared function), the bundleShared function is not performing any actions. However, I saw the function doing other things as well. Therefore, wouldn't it make more sense to have a check if there are any "node" externals, so if the object is not empty? Instead of an extra ssr flag. My second pointI am not entirely sure why, but apparently some packages can be node and some can be browser. I am doubting that this is desired in an application. Therefore the suggestion, shouldn't we remove the node check entirely and go for your solution of a global "is ssr" instead of "platform: node" per external. Edit: maybe this is intended indeed, so we can skip the second discussion point. |
'node' | ||
); | ||
// If SSR is not enabled, we can avoid bundling for the server. | ||
const sharedPackageInfoServer = fedOptions.ssr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const sharedPackageInfoServer = fedOptions.ssr | |
const sharedPackageInfoServer = (Object.keys(sharedServer).length > 0) |
'node' | ||
); | ||
// If SSR is not enabled, we can avoid bundling for the server. | ||
const separatePackageInfoServer = fedOptions.ssr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const separatePackageInfoServer = fedOptions.ssr | |
const separatePackageInfoServer = (Object.keys(separateServer).length > 0) |