-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Optimize webpack chunking #38329
Optimize webpack chunking #38329
Conversation
290a872
to
4d31699
Compare
I think this is a great initiative. I'd have one concern which is due to the fact that we currently still require to have the bundles committed in the repository itself. The dynamic naming with numeric identifiers has the risk that we end up having leftover chunks in the dist folder if they are not cleaned up before each production build, so we need to double check that this is the case. |
Ok, might actually be the case already with https://github.com/nextcloud/server/blob/pulsejet/patch-webpack/webpack.common.js#L59-L61 |
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.
Eslint is not happy, otherwise this seems good from my perspective.
Thank you @pulsejet for not giving up on this 💙 |
7eb442a
to
275b75a
Compare
Never knew about this, but seems it'll do the trick: https://webpack.js.org/guides/output-management/#cleaning-up-the-dist-folder. ESLint should pass now. |
Just noticed something funny: this is actually also a bug fix at certain points. For instance, we explicitly want to do lazy loading (before this PR) at this line for server/core/src/views/UnsupportedBrowser.vue Lines 125 to 130 in fa3bbb2
|
This check is very expensive, and will pass almost 100% of the time. Related #36728 Depends on #38329 Signed-off-by: Varun Patil <[email protected]>
This check is very expensive, and will pass almost 100% of the time. Related #36728 Depends on #38329 Signed-off-by: Varun Patil <[email protected]>
This check is very expensive, and will pass almost 100% of the time. Related #36728 Depends on #38329 Signed-off-by: Varun Patil <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
Short before (top) and after (bottom) video for this (warm cache for both): prtest.mp4 |
e3c1b5d
to
a150c8c
Compare
Bump? I really don't understand what keeps blocking this... |
@nextcloud/server-frontend could you review/approve ? |
118e8cf
to
a34c8fb
Compare
This makes tree shaking possible Signed-off-by: Varun Patil <[email protected]>
Signed-off-by: Varun Patil <[email protected]>
Signed-off-by: Varun Patil <[email protected]>
Signed-off-by: Daniel Kesselberg <[email protected]>
a34c8fb
to
7d02d98
Compare
@pulsejet rebased, compiled and force-pushed your branch. Used node 18.7 and npm 8.15 to build locally. |
Thanks @kesselb. Just curious: doesn't the bot do that usually or I should be pushing compiled assets to the PR? |
27 being released and master being in feature freeze. |
the bot needs to be called for it :) |
Thanks for pushing this through @skjnldsv 🎉 |
Now that I finally upgraded my instance to 28, I want to say thank you for this PR again @pulsejet |
Supercedes and closes #35432
This takes a much simpler approach for achieving something similar to the linked PR. Instead of lazy loading every component, webpack directly allows only splitting components used in more than
n
modules. By tweaking this parameter (3 seems to have great results), we can split the chunks efficiently achieving similar performance gains. This is also much less invasive and more semantically meaningful.Some amount of async loading is still needed since apps greedily attempt to load a lot of things.
Files app (no cache):
Files app (with cache):
Memories (no cache):
Video of load performance (before on top, after on bottom)
https://github.com/nextcloud/server/assets/10709794/5ab1144e-c811-4b8d-9798-463982b46cb7