Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
vite-plugin-env-file
Advanced tools
This Vite plugin allows you to dynamically update your `.env` file during the build process. It's particularly useful for injecting environment variables that depend on the build or development server settings.
This Vite plugin allows you to dynamically update your .env
file during the build process. It's particularly useful for injecting environment variables that depend on the build or development server settings.
To install the plugin, you can use either npm or yarn. Run one of the following commands in your project directory:
npm install vite-plugin-env-file
or yarn add vite-plugin-env-file
Add it to vite.config.js
import viteEnvFile from 'vite-plugin-env-file'
export default {
plugins: [
viteEnvFile({
dev_server_port: 3008,
dev_server_public_url: 'https://www.vite.com',
dev_server_enabled: true
})
],
}
This would render a vite.env
in the project root with something like this:
VITE_DEV_SERVER_PORT="3008"
VITE_DEV_SERVER_PUBLIC_URL="https://www.vite.com"
VITE_DEV_SERVER_ENABLED="true"
When the buildEnd
method is called, these variables and vite.env
file are deleted.
The plugin function takes two arguments: envVars
and options
.
object
or falsy
{ 'custom_var': 'value' }
object
(optional)prefix
: The prefix to be added to all environment variable names.
string
'VITE_'
forceUpperCase
: Whether to convert all environment variable names to uppercase.
boolean
true
envFile
: The name of the environment file to be updated.
string
'vite.env'
FAQs
This Vite plugin allows you to dynamically update your `.env` file during the build process. It's particularly useful for injecting environment variables that depend on the build or development server settings.
The npm package vite-plugin-env-file receives a total of 38 weekly downloads. As such, vite-plugin-env-file popularity was classified as not popular.
We found that vite-plugin-env-file demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.