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

Add options to support SPAs in StaticFiles #2591

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

Conversation

estheruary
Copy link

@estheruary estheruary commented May 8, 2024

Summary

There are two changes supporting one aim, if you don't consider that to be atomic I can open two PRs.

  1. Support loading files from packages that might not be present at instantiation and are built asynchronously from webpack and it's contemporaries.
  2. The fallback_file option which is used in client side routing. These tools expect that any path that doesn't resolve to a file in the build directory will return the main SPA file (typically index.html).

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Fixes #1821

An example of someone in the wild wanting this kind of functionality: https://stackoverflow.com/questions/63069190. I think the examples you find around the web to be insufficient in the case where index.html is part of your static bundle that might live in a package.

There are two changes, the first is to support loading files from
packages that might not be present at instantiation and are built
asynchronously from webpack or the like. This is already supported for
the directory option but it works with packages as well. The second is
the fallback_file option which is used in client side routing. These
tools expect that any path that doesn't resolve to a file in the build
directory will return the main SPA file (typically index.html).
@Kludex
Copy link
Sponsor Member

Kludex commented May 8, 2024

I think we tried to introduce the "fallback_file" with a different name some time ago... 🤔

I prefer the changes to be atomic, yes. And I think there's a discussion, or PR about your first point - you might want to check that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants