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

feat(core): faster HTML minimizer - siteConfig.future.experimental_faster.swcHtmlMinimizer #10554

Merged
merged 7 commits into from
Oct 4, 2024

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Oct 3, 2024

Docusaurus Faster

This PR is part of the Docusaurus Faster project aiming at reducing production build times

Motivation

The Docusaurus SSG step takes around ~7s, mainly because of HTML minification with html-minifier-terser being slow.

This PR add an opt-in for the new @swc/html minifier, with the following results:

  • the SSG phase now only takes ~2.5s 🔥
  • Argos does not report any visual regression
  • CI does not report any new React hydration errors (part of Argos GH Action job)
  • HTML size reduced by 4%

Note: related SWC HTML minifier discussion: swc-project/swc#9616

Test Plan

CI + preview + argos

Test links

https://deploy-preview-10554--docusaurus-2.netlify.app/

@slorber slorber added pr: new feature This PR adds a new API or behavior. Argos Add this label to run UI visual regression tests. See argos.yml GH action. labels Oct 3, 2024
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 3, 2024
Copy link

netlify bot commented Oct 3, 2024

[V2]

Name Link
🔨 Latest commit fdecad5
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/670012d4f6e0b00008be4901
😎 Deploy Preview https://deploy-preview-10554--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Oct 3, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟢 90 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🟠 59 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 74 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 61 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 47 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 63 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 74 🟢 100 🟢 100 🟠 86 Report

Copy link

github-actions bot commented Oct 3, 2024

Size Change: -474 kB (-4.1%)

Total Size: 11.1 MB

Filename Size Change
website/.docusaurus/docusaurus.config.mjs 28 kB +32 B (+0.11%)
website/build/assets/js/main.********.js 667 kB +49 B (+0.01%)
website/build/blog.html 58.1 kB -3.28 kB (-5.35%)
website/build/blog/2017/12/14/introducing-docusaurus.html 72.2 kB -2.48 kB (-3.33%)
website/build/blog/2018/04/30/How-I-Converted-Profilo-To-Docusaurus.html 45.1 kB -2.16 kB (-4.57%)
website/build/blog/2018/09/11/Towards-Docusaurus-2.html 49.4 kB -2.22 kB (-4.3%)
website/build/blog/2018/12/14/Happy-First-Birthday-Slash.html 28.6 kB -1.76 kB (-5.78%)
website/build/blog/2019/12/30/docusaurus-2019-recap.html 37.5 kB -2.03 kB (-5.14%)
website/build/blog/2020/01/07/tribute-to-endi.html 32.1 kB -1.9 kB (-5.58%)
website/build/blog/2021/01/19/docusaurus-2020-recap.html 46.5 kB -2.35 kB (-4.8%)
website/build/blog/2021/03/09/releasing-docusaurus-i18n.html 42.9 kB -2.25 kB (-4.98%)
website/build/blog/2021/05/12/announcing-docusaurus-two-beta.html 45.2 kB -2.26 kB (-4.75%)
website/build/blog/2021/11/21/algolia-docsearch-migration.html 50.3 kB -2.62 kB (-4.94%)
website/build/blog/2022/01/24/docusaurus-2021-recap.html 42.4 kB -2.14 kB (-4.81%)
website/build/blog/2022/08/01/announcing-docusaurus-2.0.html 134 kB -5.1 kB (-3.67%)
website/build/blog/2022/09/01/docusaurus-2.1.html 48.2 kB -2.67 kB (-5.25%)
website/build/blog/archive.html 23.1 kB -1.54 kB (-6.23%)
website/build/blog/authors.html 43.9 kB -2.61 kB (-5.62%)
website/build/blog/authors/j-marcey.html 61.9 kB -3.15 kB (-4.85%)
website/build/blog/authors/josh-cena.html 40.7 kB -2.34 kB (-5.45%)
website/build/blog/authors/lex-111.html 47.6 kB -2.61 kB (-5.2%)
website/build/blog/authors/slorber.html 58 kB -3.56 kB (-5.78%)
website/build/blog/authors/slorber/authors/2.html 61.8 kB -3.61 kB (-5.52%)
website/build/blog/authors/slorber/authors/3.html 73.6 kB -4.01 kB (-5.16%)
website/build/blog/authors/slorber/authors/4.html 42.1 kB -2.59 kB (-5.79%)
website/build/blog/authors/yangshun.html 54.8 kB -2.91 kB (-5.03%)
website/build/blog/authors/zpao.html 41.1 kB -2.38 kB (-5.47%)
website/build/blog/page/2.html 62.6 kB -3.33 kB (-5.05%)
website/build/blog/page/3.html 68.3 kB -3.46 kB (-4.82%)
website/build/blog/page/4.html 61.1 kB -3.01 kB (-4.7%)
website/build/blog/page/5.html 39.8 kB -2.07 kB (-4.96%)
website/build/blog/preparing-your-site-for-docusaurus-v3.html 132 kB -5.71 kB (-4.14%)
website/build/blog/releases/2.2.html 47.1 kB -2.55 kB (-5.13%)
website/build/blog/releases/2.3.html 57.9 kB -2.9 kB (-4.76%)
website/build/blog/releases/2.4.html 62.1 kB -3.15 kB (-4.83%)
website/build/blog/releases/3.0.html 107 kB -4.88 kB (-4.38%)
website/build/blog/releases/3.1.html 49.5 kB -2.46 kB (-4.73%)
website/build/blog/releases/3.2.html 46.3 kB -2.52 kB (-5.16%)
website/build/blog/releases/3.3.html 52.9 kB -2.65 kB (-4.77%)
website/build/blog/releases/3.4.html 53.1 kB -2.73 kB (-4.88%)
website/build/blog/releases/3.5.html 55.3 kB -2.77 kB (-4.76%)
website/build/blog/tags.html 26.7 kB -1.83 kB (-6.41%)
website/build/blog/upgrading-frontend-dependencies-with-confidence-using-visual-regression-testing.html 123 kB -4.97 kB (-3.88%)
website/build/docs.html 47 kB -2.15 kB (-4.38%)
website/build/docs/advanced.html 29.4 kB -1.72 kB (-5.53%)
website/build/docs/advanced/architecture.html 28.9 kB -1.73 kB (-5.63%)
website/build/docs/advanced/client.html 72.7 kB -3.28 kB (-4.31%)
website/build/docs/advanced/plugins.html 56 kB -2.62 kB (-4.47%)
website/build/docs/advanced/routing.html 70.8 kB -3.06 kB (-4.14%)
website/build/docs/advanced/ssg.html 77.8 kB -3.67 kB (-4.5%)
website/build/docs/api/docusaurus-config.html 194 kB -8.4 kB (-4.15%)
website/build/docs/api/misc/@docusaurus/eslint-plugin.html 45.7 kB -2.61 kB (-5.4%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-html-links.html 36 kB -2.13 kB (-5.6%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-untranslated-text.html 34.9 kB -2.02 kB (-5.45%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading.html 36.2 kB -2.04 kB (-5.33%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/string-literal-i18n-messages.html 39.8 kB -2.17 kB (-5.17%)
website/build/docs/api/misc/@docusaurus/logger.html 37.9 kB -1.96 kB (-4.93%)
website/build/docs/api/misc/create-docusaurus.html 33 kB -1.81 kB (-5.2%)
website/build/docs/api/plugin-methods.html 64.6 kB -2.79 kB (-4.14%)
website/build/docs/api/plugin-methods/extend-infrastructure.html 60.2 kB -2.75 kB (-4.36%)
website/build/docs/api/plugin-methods/i18n-lifecycles.html 58.1 kB -2.56 kB (-4.21%)
website/build/docs/api/plugin-methods/lifecycle-apis.html 164 kB -6.07 kB (-3.56%)
website/build/docs/api/plugin-methods/static-methods.html 44.4 kB -2.17 kB (-4.66%)
website/build/docs/api/plugins.html 29.9 kB -1.76 kB (-5.56%)
website/build/docs/api/plugins/@docusaurus/plugin-client-redirects.html 59.5 kB -3.04 kB (-4.87%)
website/build/docs/api/plugins/@docusaurus/plugin-content-blog.html 189 kB -8.94 kB (-4.52%)
website/build/docs/api/plugins/@docusaurus/plugin-content-docs.html 194 kB -8.66 kB (-4.28%)
website/build/docs/api/plugins/@docusaurus/plugin-content-pages.html 74 kB -4.05 kB (-5.2%)
website/build/docs/api/plugins/@docusaurus/plugin-debug.html 48 kB -2.5 kB (-4.96%)
website/build/docs/api/plugins/@docusaurus/plugin-google-analytics.html 48.9 kB -2.57 kB (-5%)
website/build/docs/api/plugins/@docusaurus/plugin-google-gtag.html 48.5 kB -2.56 kB (-5.03%)
website/build/docs/api/plugins/@docusaurus/plugin-google-tag-manager.html 47.3 kB -2.51 kB (-5.05%)
website/build/docs/api/plugins/@docusaurus/plugin-ideal-image.html 48.4 kB -2.72 kB (-5.33%)
website/build/docs/api/plugins/@docusaurus/plugin-pwa.html 116 kB -5.61 kB (-4.61%)
website/build/docs/api/plugins/@docusaurus/plugin-sitemap.html 65.3 kB -3.22 kB (-4.7%)
website/build/docs/api/plugins/@docusaurus/plugin-vercel-analytics.html 39.9 kB -2.29 kB (-5.44%)
website/build/docs/api/themes.html 28.7 kB -1.7 kB (-5.58%)
website/build/docs/api/themes/@docusaurus/theme-classic.html 44 kB -2.39 kB (-5.15%)
website/build/docs/api/themes/@docusaurus/theme-live-codeblock.html 36.6 kB -2.08 kB (-5.37%)
website/build/docs/api/themes/@docusaurus/theme-mermaid.html 35.5 kB -2.02 kB (-5.38%)
website/build/docs/api/themes/@docusaurus/theme-search-algolia.html 32.8 kB -1.9 kB (-5.46%)
website/build/docs/api/themes/configuration.html 243 kB -12.9 kB (-5.03%)
website/build/docs/blog.html 211 kB -7.75 kB (-3.54%)
website/build/docs/browser-support.html 48.4 kB -2.59 kB (-5.08%)
website/build/docs/category/getting-started.html 26.6 kB -1.61 kB (-5.69%)
website/build/docs/category/guides.html 34.5 kB -1.91 kB (-5.24%)
website/build/docs/cli.html 59.9 kB -3.84 kB (-6.02%)
website/build/docs/configuration.html 98.7 kB -4.42 kB (-4.28%)
website/build/docs/create-doc.html 62.3 kB -2.98 kB (-4.57%)
website/build/docs/creating-pages.html 56.4 kB -2.71 kB (-4.58%)
website/build/docs/deployment.html 203 kB -8.34 kB (-3.94%)
website/build/docs/docs-introduction.html 50.9 kB -2.65 kB (-4.95%)
website/build/docs/docs-multi-instance.html 75 kB -3.76 kB (-4.78%)
website/build/docs/docusaurus-core.html 236 kB -9.21 kB (-3.75%)
website/build/docs/guides/whats-next.html 30.9 kB -1.91 kB (-5.81%)
website/build/docs/i18n/crowdin.html 145 kB -6.12 kB (-4.06%)
website/build/docs/i18n/git.html 78.8 kB -3.82 kB (-4.62%)
website/build/docs/i18n/introduction.html 48.3 kB -2.48 kB (-4.89%)
website/build/docs/i18n/tutorial.html 164 kB -7.24 kB (-4.24%)
website/build/docs/installation.html 70.7 kB -3.47 kB (-4.68%)
website/build/docs/markdown-features.html 79.9 kB -3.29 kB (-3.96%)
website/build/docs/markdown-features/admonitions.html 113 kB -5.09 kB (-4.3%)
website/build/docs/markdown-features/assets.html 89.2 kB -4.3 kB (-4.6%)
website/build/docs/markdown-features/code-blocks.html 235 kB -10 kB (-4.09%)
website/build/docs/markdown-features/diagrams.html 53.1 kB -2.87 kB (-5.13%)
website/build/docs/markdown-features/head-metadata.html 50.1 kB -2.67 kB (-5.06%)
website/build/docs/markdown-features/links.html 40.8 kB -2.31 kB (-5.37%)
website/build/docs/markdown-features/math-equations.html 90.5 kB -4.87 kB (-5.1%)
website/build/docs/markdown-features/plugins.html 96.6 kB -4.29 kB (-4.25%)
website/build/docs/markdown-features/react.html 138 kB -6.3 kB (-4.38%)
website/build/docs/markdown-features/tabs.html 142 kB -6.97 kB (-4.69%)
website/build/docs/markdown-features/toc.html 84.8 kB -3.93 kB (-4.43%)
website/build/docs/migration.html 40.7 kB -2.32 kB (-5.39%)
website/build/docs/migration/v2.html 39.1 kB -2.09 kB (-5.08%)
website/build/docs/migration/v2/automated.html 40.4 kB -2.28 kB (-5.34%)
website/build/docs/migration/v2/manual.html 198 kB -8.52 kB (-4.12%)
website/build/docs/migration/v2/translated-sites.html 50.3 kB -2.49 kB (-4.71%)
website/build/docs/migration/v2/versioned-sites.html 64.2 kB -2.98 kB (-4.43%)
website/build/docs/migration/v3.html 209 kB -8.78 kB (-4.03%)
website/build/docs/playground.html 30.7 kB -1.79 kB (-5.52%)
website/build/docs/search.html 116 kB -4.82 kB (-3.99%)
website/build/docs/seo.html 88.7 kB -4.26 kB (-4.58%)
website/build/docs/sidebar.html 130 kB -6.11 kB (-4.49%)
website/build/docs/sidebar/autogenerated.html 150 kB -6.35 kB (-4.06%)
website/build/docs/sidebar/items.html 180 kB -7.84 kB (-4.18%)
website/build/docs/sidebar/multiple-sidebars.html 63.7 kB -3.4 kB (-5.06%)
website/build/docs/static-assets.html 53.4 kB -2.8 kB (-4.98%)
website/build/docs/styling-layout.html 135 kB -6.06 kB (-4.3%)
website/build/docs/swizzling.html 115 kB -5.15 kB (-4.28%)
website/build/docs/typescript-support.html 62.3 kB -3.04 kB (-4.66%)
website/build/docs/using-plugins.html 110 kB -5.01 kB (-4.34%)
website/build/docs/versioning.html 83.1 kB -3.99 kB (-4.58%)
website/build/index.html 35.8 kB -1.9 kB (-5.05%)
ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/codeTranslations.json 2 B 0 B
website/.docusaurus/globalData.json 30.2 kB 0 B
website/.docusaurus/i18n.json 930 B 0 B
website/.docusaurus/registry.js 155 kB 0 B
website/.docusaurus/routes.js 74.3 kB 0 B
website/.docusaurus/routesChunkNames.json 81.7 kB 0 B
website/.docusaurus/site-metadata.json 2.17 kB 0 B
website/build/assets/css/styles.********.css 119 kB 0 B
website/build/assets/js/runtime~main.********.js 35.1 kB +13 B (+0.04%)
website/build/docs/introduction/index.html 280 B 0 B
website/build/docs/resources/index.html 325 B 0 B
website/build/docs/support/index.html 319 B 0 B
website/build/docs/team/index.html 310 B 0 B

compressed-size-action

Copy link

argos-ci bot commented Oct 3, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Oct 4, 2024, 4:22 PM

Copy link

socket-security bot commented Oct 4, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

🚮 Removed packages: npm/@argos-ci/[email protected], npm/@mdx-js/[email protected], npm/@netlify/[email protected], npm/@playwright/[email protected], npm/[email protected]

View full report↗︎

@slorber slorber changed the title feat(core): WIP test using SWC html minifier feat(core): faster HTML minimizer - siteConfig.future.experimental_faster.swcHtmlMinimizer Oct 4, 2024
@slorber slorber marked this pull request as ready for review October 4, 2024 13:27
@slorber slorber mentioned this pull request Oct 4, 2024
@slorber slorber merged commit 912c495 into main Oct 4, 2024
37 checks passed
@slorber slorber deleted the slorber/faster-html-minifier branch October 4, 2024 16:26
kdy1 pushed a commit to swc-project/swc that referenced this pull request Oct 6, 2024
**Description:**

 - `preserveComments` is optional but required in the TS type

 - `removeRedundantAttributes` is an enum and passing a boolean leads to errors

See https://github.com/swc-project/swc/blob/main/crates/swc_html_minifier/src/option.rs#L54

**Related issue:**

 - facebook/docusaurus#10554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Argos Add this label to run UI visual regression tests. See argos.yml GH action. CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants