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

perf(login): create a custom bundle for login #39942

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

st3iny
Copy link
Member

@st3iny st3iny commented Aug 17, 2023

Summary

The standalone bundle imports src/main.js to setup all globals. Unfortunately, the login page doesn't work without globals as they are required by various bits (e.g. theming).

I tested this with theming (custom background, logo and color) and twofactor authentication.

This PR reduces the size of transferred and parsed javascript bundles to around ~50%. Together with Robin's PR the login page loads significantly faster.

Before After
grafik grafik

Checklist

@st3iny st3iny self-assigned this Aug 17, 2023
@st3iny st3iny changed the title Login less custom bundle perf(login): create a custom bundle for login Aug 17, 2023
@st3iny st3iny requested review from icewind1991, skjnldsv, a team, susnux and artonge and removed request for skjnldsv, a team and icewind1991 August 21, 2023 11:42
@st3iny st3iny added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 21, 2023
@st3iny st3iny modified the milestones: Nextcloud 29, Nextcloud 28 Aug 21, 2023
@st3iny st3iny marked this pull request as ready for review August 21, 2023 11:48
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane

Comment on lines +47 to +56
const standaloneEntries = {
entry: modulesToBuild({
core: {
login_standalone: path.join(__dirname, 'core/src', 'login.js'),
},
}),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super fond of splitting the config even more, but I guess that's the only way to avoid core-common 🤔

To be fair, since we're logging in, the core-common will be fetched after log in anyway 😁

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the splitting is a bit ugly 🙈

To be fair the main problem with js bundles is the time spent parsing not the fetching itself as they are mostly cached by the browser anyway. The core-common bundle contains every dependency bundled from node_modules, most of which was parsed for no reason on the login page.

@st3iny
Copy link
Member Author

st3iny commented Sep 26, 2023

Again, drone failure is unrelated and caused by failing DNS resolutions.

fatal: unable to access 'https://github.com/nextcloud/server.git/': Could not resolve host: github.com

@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
@ChristophWurst
Copy link
Member

rebase & merge?

@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Feb 23, 2024
@icewind1991
Copy link
Member

/compile amend

This bundle doesn't depend on core-common.js and thus improves
performance of the login page's frontend.

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@skjnldsv
Copy link
Member

skjnldsv commented Mar 6, 2024

Cypress failure is related

TypeError: Cannot read properties of undefined (reading 'rules')
    at webpackConfig (/home/runner/actions-runner/_work/server/server/cypress.config.ts:119:19)

This was referenced Mar 12, 2024
This was referenced Mar 20, 2024
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@skjnldsv skjnldsv modified the milestones: Nextcloud 29, Nextcloud 30 Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ In progress
Development

Successfully merging this pull request may close these issues.

None yet

6 participants