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): support an offline mode build - Hash Router solution #9859

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Feb 16, 2024

Motivation

WIP/POC attempt to solve #3825 and make a Docusaurus build usable without a server, distributed as a docs.zip file for example.

This attempt assumes we want to generate a single static index.html file, and use a hash router + client-side React to render the correct page:

  • index.html/#
  • index.html/#/docs
  • index.html/#/docs/typescript-support

See possible solutions/alternatives here:
#3825 (comment)

It seems to be a reasonable approach, although we lose the ability to emit multiple static files (which is probably not a big deal?)

Test Plan

???

Test links

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 16, 2024
Copy link

netlify bot commented Feb 16, 2024

[V2]

Name Link
🔨 Latest commit 2f33aad
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/65d8eab7eef7f50008084160
😎 Deploy Preview https://deploy-preview-9859--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 Feb 16, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 75 🟢 98 🟢 96 🟢 100 🟠 88 Report
/docs/installation 🟠 68 🟢 96 🟢 100 🟢 100 🟠 88 Report
/docs/category/getting-started 🟠 75 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog 🟠 70 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 63 🟢 96 🟢 100 🟢 100 🟠 88 Report
/blog/tags/release 🟠 71 🟢 100 🟢 100 🟠 80 🟠 88 Report
/blog/tags 🟠 73 🟢 100 🟢 100 🟢 90 🟠 88 Report

Copy link

github-actions bot commented Feb 16, 2024

Size Change: -34.2 kB (-3%)

Total Size: 958 kB

Filename Size Change
website/build/assets/js/main.********.js 765 kB +238 B (0%)
website/build/index.html 3.47 kB -34.5 kB (-91%) 🏆
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 75.4 kB
website/build/assets/css/styles.********.css 114 kB

compressed-size-action

@slorber slorber added pr: new feature This PR adds a new API or behavior. to backport This PR is planned to be backported to a stable version of Docusaurus labels Feb 22, 2024
@zayne-wang
Copy link

Looking forward that this will be release in the future!

@lebalz
Copy link
Contributor

lebalz commented May 2, 2024

What is the state of this? Is there anything we could help with to get this merged?

@slorber
Copy link
Collaborator Author

slorber commented May 3, 2024

Busy on other things.

I'll try to get this merged for the next minor/major.

The POC is working but I'm not sure it's super robust regarding edge cases.

Maybe we could ship it as experimental first, and get early adopter feedback to fix bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior. to backport This PR is planned to be backported to a stable version of Docusaurus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants