-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
adapter-auto: defer adapter installation until required #7739
Conversation
🦋 Changeset detectedLatest commit: 84fa75a 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 |
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.
Makes sense to me and should probably resolve the "double package" problem one can run into - leaving this open so others can give their opinions on this
If we add new capabilities to adapters in future — for example, if they're allowed to control aspects of the dev environment — then this won't work |
Probably we don't want the auto adapter to be affecting dev mode? It wouldn't have any of the env vars it looks at anyway. Presumably people should explicitly install their target adapter if they want to have it impact dev mode too. |
To provide platform specific features in dev mode you'd have to know what platform you'd be deploying to, and at that point adapter-auto can be swapped out manually. I thought the idea was that adapter-auto would serve as a minimal deployable setup for new users unfamiliar with |
That's a fair point! I rescind my earlier comments. That said, I'm not 100% sure I understand what problem this solves? |
/** | ||
* @returns {Promise<Adapter | undefined>} The corresponding adapter for the current environment if found otherwise undefined | ||
*/ | ||
async function get_adapter() { |
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.
I'd make it clearer from the name that this is installing the adapter as get
sounds side-effect free
async function get_adapter() { | |
async function install_adapter() { |
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.
In some cases it won't install anything though. We could make it get_or_install_adapter
or whatever but i think it's clear enough from context
Right now it's installing the adapter up-front, which seems to be doing the install in the middle of the Vite bundling causing two versions of SvelteKit to end up in the final bundle. By waiting until the bundle is written, hopefully that's fixed. I'm not 100% sure how to test this other than merging it and updating the sites repo. There's probably a way, but I'd be just as happy to merge this even if it doesn't work as I think it's a nice way to structure the code, so I'd say we merge this and see if it works |
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. All changesets should bepatch
until SvelteKit 1.0