Skip to content
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

Use import.meta.env + ENV file so hydrated components work #629

Merged
merged 2 commits into from
Nov 3, 2024

Conversation

davepagurek
Copy link
Collaborator

Resolves #627

Adds @shibomb's check to see if process.env is defined for node environments, but also falls back on import.meta.env for non-SSR components hydrated in the browser. To do this, the env vars are written to a .env file that Astro reads, and the vars that need to be read in the browser have to have a PUBLIC_ prefix for Astro to pass them through.

Also makes more schema things optional for dev builds and corrects the cleanup script from removing those changes (it was cleaning up the whole reference folder instead of just the content in reference/en/, oops)

@davepagurek davepagurek merged commit eccabb7 into main Nov 3, 2024
4 checks passed
@davepagurek davepagurek deleted the fix/hydrated-components branch November 3, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Embedded p5.js is not displayed in the local development environment.
1 participant