NuxtN
Nuxt5mo ago
4 replies
ATL

How to access environment variables of .env in pinia store in Nuxt 4

Currently in .env
TEST_APIKEY="TEST"


In pinia store
export const useGeneralStore = defineStore("general", () => {
  const testApiKey = process.env.TEST_APIKEY;

  return {
    testApiKey,
  };
});


testApiKey is empty. If I change to just include everything in process.env then following is showed

{ "NODE_ENV": "development" }
Was this page helpful?