I created a simple react app using npm init vite Appname -- --template react
command.
And in .env
file, variables have to have VITE_
prefix, and don't look good.
I checked this guide , but don't know how to change the envPrefix . Can someone tell me how to change envDir and envPrefix?
Thank you in advance for many help.
This is my vite.config.js
file.
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
})
Try updating the file to include the properties that you shared the docs for:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
envPrefix: 'CH_',
envDir: './environment'
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.