-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Allow _redirects
to be placed in root directory
#1586
Conversation
This was easier to fix than expected. The fix should allow users to have their own `_redirects` file in the project root. If this file exists, it gets copied to `build/` before `adapter-netlify` appends the catchall rule to it. This behaviour is [already documented](https://github.com/sveltejs/kit/tree/master/packages/adapter-netlify#using-netlify-redirect-rules), but [currently broken](sveltejs#1585). How can I write an automated test for this adapter? I did the following to test this manually: 1. Use `yarn link "@sveltejs/kit"` and `yarn link "@sveltejs/adapter-netlify"` in my application repository to point the two node modules to my modified versions. 2. Run `svelte-kit build` with a `_redirects` file in the project root. 3. Check if content of `build/_redirects` is expected. 4. Run `svelte-kit build` *without* a `_redirects` file in the project root. 5. Check if content of `build/_redirects` is expected. Any guidance or help how to match the desired code quality to get this PR merged is appreciated. close sveltejs#1585
@kvn-shn @sw-yx @mikenikles as our resident Netlify users, can you guys reproduce this and are you okay with this change? |
I cannot reproduce this. Actually I wouldn't change it because I believe everything is working fine. There just seems to be a small misunderstanding, see #1585 (comment) |
ah yeah what kvn-shn said. it needs to be in the final directory that gets served by netlify, and for sveltekit that is the |
Yes! 🎉 you're totally right. I'm going to close this as it's not needed. |
I would have expected it to be in the root directory, so without having looked at this much, this didn't seem like a bad change to me. Do we think |
i do think its intuitive to be in the root for people who dont know how netlify works (and pretty self explanatory if you need to move the whole thing into a monorepo setup), but am hesitant to make a special rule that only works for sveltekit but not for anything else. i dont feel strongly about this one but we can always add some docs. did one #1596 |
I'm totally happy putting my So all is well. |
_redirects
to be placed in root directory
OK, I'm happy with my own solution, too! 🤷♂️ Proud to be a Svelte-Kit code contributor now. |
This was easier to fix than expected. The fix should allow users to have their own
_redirects
file in the project root. If this file exists, it gets copied tobuild/
beforeadapter-netlify
appends the catchall rule to it.This behaviour is already documented, but currently broken.
How can I write an automated test for this adapter?
I did the following to test this manually:
yarn link "@sveltejs/kit"
andyarn link "@sveltejs/adapter-netlify"
in my application repository to point the two node modules to my modified versions.svelte-kit build
with a_redirects
file in the project root.build/_redirects
is expected.svelte-kit build
without a_redirects
file in the project root.build/_redirects
is expected.Any guidance or help how to match the desired code quality to get this PR merged is appreciated.
close #1585
Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
Changesets
pnpx changeset
and following the prompts