Vite Envs

screenshot of Vite Envs
create-react-app
react
vite

Env var in Vite at container startup

Overview

Vite has become a popular choice for building fast and efficient web applications, and with the introduction of vite-envs, the deployment process has been streamlined considerably. This innovative tool allows developers to dynamically define environment variables without the need for constant rebuilding, making it easier to customize applications according to deployment needs. With vite-envs, web apps can be shipped as customizable Docker images, providing flexibility for sysadmins and ensuring a seamless deployment experience.

By integrating effortlessly into existing projects and enhancing Vite's capabilities, vite-envs empowers developers to create more dynamic and responsive applications. The convenience of accessing environment variables right from the HTML and TypeScript files elevates the development workflow while maintaining security and type safety.

Features

  • Effortless Setup: Integrates smoothly into existing Vite projects without disrupting Storybook or other configurations.
  • No VITE_ Prefix Necessary: Simplifies the environment variable access by eliminating the need for the standard prefix.
  • Type-Safe: Provides type definitions for import.meta.env, ensuring a robust development experience with hot reload capabilities.
  • Dynamic HTML Usage: Allows the use of environment variables directly in HTML files, e.g., <title>%FOO%</title>.
  • Computed Values at Build Time: Supports calculations of environment values at build time for added flexibility.
  • EJS Expression Support: Optionally enables EJS expressions in your index.html, making it possible to manipulate variables directly in HTML.
  • Secure Variable Injection: Only injects explicitly defined environment variables from the .env file, ensuring a secure build process.
  • Custom Declaration Files: Offers the ability to declare variables in an alternative file like .env.declaration if .env is gitignored, catering to different project needs.
create-react-app
Create React App

Create React App is a popular tool for quickly setting up a new React project without the need for manual configuration or setup. It provides a preconfigured development environment with modern build tools, a live development server, and an easy-to-use command line interface.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components

vite
Vite

Vite is a build tool that aims to provide a faster and leaner development experience for modern web projects

docker
Docker

A website that uses Docker for containerization to streamline development, testing, and deployment workflows. This includes features such as containerization of dependencies, automated builds and deployments, and container orchestration to ensure scalability and availability.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.