I am trying to access environment variables from the client side on my Nuxt project.
I have a simple .env file which contains:
NUXT_GITHUB_TOKEN=mytoken
And from a SimpleComponent.vue I am trying to access it like so:
created() {
const runtimeConfig = useRuntimeConfig();
console.log(runtimeConfig.NUXT_GITHUB_TOKEN);
}
That console.log there will print undefined. Since I am trying to save a github token I can't set the variable inside the nuxt.config.js file.
How can I get this done in Nuxt3?