Replies: 2 comments 1 reply
-
Hello, same error here. Did you find a workaround? |
Beta Was this translation helpful? Give feedback.
0 replies
-
To prevent accidentally leaking environment variables to the client, you need to list public environment variables in an example file (e.g., .env.example), and explicitly define it via the import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ImportMetaEnvPlugin from "@import-meta-env/unplugin"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
ImportMetaEnvPlugin.vite({
+ example: ".env.example",
env: ".env"
}),
vue()
],
envDir: './',
server: {
port: 3000,
host: "0.0.0.0"
},
base: "/test/"
}) https://import-meta-env.org/guide/getting-started/compile-time-transform.html#plugin-options |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Initialization of application does not work adding unplugin (npm run dev or npm run build)
I get this exception:
vite.config.js configs tried:
ImportMetaEnvPlugin.vite()
, same error.package.json:
Env file exists:
Beta Was this translation helpful? Give feedback.
All reactions