-
-
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
feat: route level config #8740
feat: route level config #8740
Conversation
|
I don't think there's ever a good reason for that not to happen — i think it's appropriate for prerendered routes to be excluded from this process. i'd almost go so far as to say that
One idea is to use the same logic we currently use — if Not sure if we need to account for memory and maxDuration options (for Vercel serverless functions) as well. Though I'd probably take the existence of those options as a signal that the route should be a standalone function (to the extent allowed by route ambiguity). Another idea would be to make it explicit, with a property like export const config = {
runtime: 'edge',
group: 'potato'
}; I don't love that idea though.
I think it'd probably be enough to have a default config that applies to all routes in the absence of specified config. That would mean that you could (for example) have all your API routes run on Node while all your pages are rendered at the edge: // svelte.config.js
export default {
kit: {
adapter: adapter({
defaultConfig: {
runtime: 'node18',
region: 'us-east-1'
}
})
}
}; // src/routes/+layout.server.js
export const config = {
runtime: 'edge',
region: 'all'
}; |
I don't really understand the difference here to be honest. My take:
|
@ascorbic wanted to flag this PR with you since it seems likely that |
I bumped |
|
||
## config | ||
|
||
With the concept of [adapters](/docs/adapters), SvelteKit is able to run on a variety of platforms. Each of these might have specific configuration to further tweak the deployment — for example with Vercel or Netlify you could chose to deploy some parts of your app on the edge and others on serverless environments. |
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.
choose
@dummdidumm very interesting and promising, could this in the future evolve into allowing to e.g. default deploy to Cloudflare Pages with some routes deploy externally to sthg like fly.io? Just curious, actually kinda unsure how useful this is over having a monorepo auto-deploy using GitHub Actions the main app to CF and separate "functions" to fly or sthg like that. It's probably more likely to stay in userland and/or on a per project basis I guess¿! |
Right now |
Yea I totally understand, was just curious if this was somehow already planned or sthg 😇 |
It doesn't look like this is working, visiting a website deployed on Vercel with the following config gives an error in the function logs. export const config = {
isr: {
expiration: 60,
},
};
|
closes #8383
Open questions:
builder.createEntries
is probably the wrong place for this, because it only contains non-prerendered pages, but you could have prerendered pages which you want to deploy to different runtimes/regions (or am I mistaken here and this doesn't matter since assets always go to some special static cdn? even if, is the API general-purpose enough for this to be ok for all adapters?) - answer: yescreateEntries
is the correct APIcreateManifest
andfilter
enable thisPlease 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:
.