-
-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: copy _headers
and _redirects
from project root instead of /static
#13227
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
Conversation
🦋 Changeset detectedLatest commit: d294e4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
preview: https://svelte-dev-git-preview-kit-13227-svelte.vercel.app/ this is an automated message |
So people would no longer do
they would put it in the root directly?
Do you remember why we did it originally by putting it in |
Yes, that's right.
I don't think it was ever intentional but it was the only way to have the files copied over to the root of the build output automatically without changes in the adapter. |
_headers
and _redirects
files need to be excluded from the service worker's files_headers
and _redirects
from project root instead of /static
I've changed it so that we copy the files from the project root now instead of relying on |
6.0.0 results in this Pages deployment failure, at least for me (Kit is 2.20.1) – I'd be happy to open an issue if that's a better process for you:
Interestingly CF does not consider this a build failure? The build itself seems to work fine, but it falls down right after the worker is compiled and the assets published. (My |
Please open an issue with a reproduction |
Will do! I believe my issue has more to do with 'fix: write server files to _worker.js/ directory' than this, based on what I'm seeing in the builds. Currently trying to trigger the same problem in a fresh repo using some server routes to get the same |
It seems like this is indeed the issue! I've tested it, and there’s no problem with this release. |
Well, I think it's got to do with the But that's enough from me here in this unrelated PR until I can actually reproduce in some minimal non-personal context edit: Yep, modules can't resolve, this has been reverted |
closes #12216
This PR documents the fact thatthe two Cloudflare Pages specific files need to be excluded from the service worker's files or the service worker will fail to register if it tries to add them to the cache. This is because the files are not publicly available after the app is deployed and the service worker will error if it can't find them from the internet.It would be nicer if we could use the adapter to exclude them but I don't know of an easy way to hook into the service worker build process or to modify the final output.Alternatively,we could stop encouraging_headers
and_redirects
files in the/static
directory as mentioned in the docs, and have the adapter read/copy them from the root of the project instead. Technically, they never should have been in the/static
directory since they are not meant to be public files. This would be a breaking change but it does fix this issue in a better way.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits