swyxio / swyxkit

An opinionated blog starter for SvelteKit + Tailwind + Netlify. Refreshed for SvelteKit 1.0!
https://swyxkit.netlify.app/
MIT License
682 stars 89 forks source link

use sveltejs/adapter-auto #100

Closed ak4zh closed 2 years ago

ak4zh commented 2 years ago

Switched @sveltejs/adapter-netlify to @sveltejs/adapter-auto Will close #74

Working deployments:

swyxio commented 2 years ago

sounds good. i have my own skepticism of adapter-auto, as it means we are constrained to using lowest-common-denominator features of all 3 platforms. but not backed by any research.

ak4zh commented 2 years ago

@sw-yx I am not sure, but it seems adapter-auto detects the platform and installs the latest version of the platform specific adapter. Additionally, if you want to lock the adapter version it seems we can add platform specific adapter alog with the auto.

I haven't tried, but as per the adapter-netlify readme it seems this should be possible.

If you're using adapter-auto, you don't need to install this unless you need to specify Netlify-specific options, since it's already included.

"@sveltejs/adapter-auto": "^1.0.0-next.66",
"@sveltejs/adapter-netlify": "^1.0.0-next.71",
swyxio commented 2 years ago

yeah so the question is what exactly are the netlify specific options, and when do we want to use them

for example the edge rendering looks really good. not sure how adapter-auto works with vercel/cloudflare offerings

ak4zh commented 2 years ago

@sw-yx I think everything you set as adapter options are the platform specific options.

To emable edge in verdel you do following:

import adapter from '@sveltejs/adapter-vercel';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter({ edge: true }),
    }
};

for netlify it’s:

import adapter from '@sveltejs/adapter-netlify';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter({ edge: true }),
    }
};

I am not sure if setting the edge to true in adapter-auto enabled for both, if not then may be we need to add a new var PLATFORM and import the adapter depending on the env var. Or may be dig deeper into the adapter-auto code to see how it detects the platform and use appropriate adapter.

For now we are not using any platform specific options so it is safe to use adapter-auto as it deploys on with netlify and vercel.

swyxio commented 2 years ago

ok lets see how it goes - is this PR still in draft or is it good to go?

swyxio commented 2 years ago

failling build now image

swyxio commented 2 years ago

this works so sticking with this for now but i have reported the issue in https://github.com/sveltejs/kit/issues/6592