
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
vite-plugin-define-process-env
Advanced tools
Vue-cli 项目迁移到 vite 时,需要将原有的环境变量前缀从 VUE_APP_ 修改为 VITE_ ,同时将业务代码中的 process.env.VUE_APP_XXX 修改为 import.meta.env.VITE_XXX 。如果你不想手动完成这一工作,可以尝试使用本插件,不需要修改任何业务代码即可轻松完成环境变量的迁移和使用。
同时,如果你不喜欢 vite 将环境变量定义到 import.meta.env 这一方式,你也可以使用本插件来代替 define 这一配置项。
npm i vite-plugin-define-process-env -D
yarn add vite-plugin-define-process-env -D
// vite.config.ts
import { defineConfig } from "vite";
import vitePluginDefineProcessEnv from "vite-plugin-define-process-env";
export default defineConfig({
...
plugins: [vitePluginDefineProcessEnv()]
});
interface Options {
path: string; // .env 文件所在的目录,默认为跟目录
key: string; // 要定义的环境变量名称,默认为 process.env
}
FAQs
A vite plugin for define env
We found that vite-plugin-define-process-env 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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.