-
Notifications
You must be signed in to change notification settings - Fork 50
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: Better docs for Vite folks #117
Conversation
🦋 Changeset detectedLatest commit: 94fb2eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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.
Thanks for the update
I made some suggestions in the section for edge-config
Co-authored-by: Ismael <ismael@vercel.com>
Co-authored-by: Ismael <ismael@vercel.com>
Thanks for the update @tcc-sejohnson! I will port these changes to https://github.com/vercel/blob as well (which will be moved here soon). Would it make sense to update our svelte templates and scripts with this snippet? |
packages/kv/README.md
Outdated
export default defineConfig(({ mode }) => { | ||
// This check is important! | ||
if (mode === 'development') { | ||
const env = loadEnv(mode); |
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.
when testing locally I had to change it to
const env = loadEnv(mode, process.cwd())
I also noticed that loadEnv
only loads VITE_
variables
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.
This didn't work for me. What did work:
if (mode === 'development') {
const env = loadEnv(mode, process.cwd(), '');
dotenvExpand.expand({parsed: env});
}
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.
Hang it, I copied the wrong example. One sec...
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.
Thanks @IsaacBreen, didn't see your comment until I had already fixed the README! He's right @correttojs, I forgot you have to specify the third parameter (it's the prefix to load, defaults to VITE_
).
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.
You're welcome! The {parsed: env}
part is important too. Vite's loadEnv
returns an object of env vars, but dotenvExpand.expand(config)
looks for them under config.parsed
.
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.
lol, thanks -- it's obviously too late over here for me to be useful
Definitely! It'll make them truly zero-config for people who clone them. |
Added a snippet explaining how to set up our clients with Vite (this has been the #1 issue filing reason thus far):
@vercel/postgres-kysely
@vercel/postgres
@vercel/kv
@vercel/edge-config