-
-
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
Add warning when not excluding _app folder in Cloudflare Pages adapter #10454
Conversation
🦋 Changeset detectedLatest commit: 8541f2c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
packages/adapter-cloudflare/index.js
Outdated
@@ -116,6 +116,13 @@ function get_routes_json(builder, assets, { include = ['/*'], exclude = ['<all>' | |||
|
|||
return rule; | |||
}); | |||
|
|||
if (!exclude.filter(rule => rule === "<build>" || rule === "/_app/*").length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would probably need to check for <all>
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would probably need to check for
<all>
as well
That wouldn't work because <all>
gets mapped to <build>
, <files>
and <prerendered>
.
This did make me realize that I made a mistake in checking after the mapping, and now the check happens before.
Checking after would mean that <build>
would get converted to the app dir so there'd be no reason to check <build>
in the first place.
And I was also checking for a hard-coded app directory which would break the check if the default app directory changes.
It looks like the PR implementing the feature originally did that, but @Rich-Harris suggested not to here: #9111 (comment). I'm not too well versed in this feature, but it sounds to me like it's required to exclude |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woah, what's this file?
'@sveltejs/adapter-cloudflare': minor | ||
--- | ||
|
||
feat: Log warning when the \_app folder is not excluded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feat: Log warning when the \_app folder is not excluded | |
feat: log warning when the `_app` folder is not excluded |
okay, re-wrapping my head around the Cloudflare Pages
IOW we're basically talking about an entirely different chunk of work. I'll open a new PR. |
closing in favour of #11593 — thanks |
Ok so basically, I spent some time trying to debug a bunch of weird 404 errors that were being thrown when I deployed to Cloudflare Pages, after some time I realized it was because I was using a custom
exclude
array that didn't exclude the _app folder.For some reason in my deployment I couldn't serve the _app folder from the server so it kept throwing a 404 error.
Initially, I thought of submitting a PR that would always exclude the _app folder, but there's probably a good reason why
SvelteKit allows for the developer to choose, so I thought it'd be nice to log a warning instead so anyone that gets in the same situation can hopefully not get stuck like me.