Skip to content

Inline environment variables #59

Answered by ElMassimo
pepicrft asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Pedro!

Vite uses dotenv to load environment variables.

Only VITE_ prefixed environment variables will be available in your client code, in import.meta.env.

See this section in the Vite docs for more information.


If using VITE_ prefixed variables is not an option, you could also use define to define constants in your vite.config.ts, which is a bit harder to use but more flexible.

  define: {
    'process.env.BUGSNAG_FRONTEND_KEY': JSON.stringify(process.env.BUGSNAG_FRONTEND_KEY),
  },

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@pepicrft
Comment options

Answer selected by ElMassimo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants