Search code examples
vue.jsenvironment-variablescodesandbox

Vue .env variable in codesandbox


how can i use .env variable in Codesandbox ? For now i've this error when using a .env file with process.env : 'process' is not defined - eslint

I've try to declare process to true in a .eslintrc file : https://eslint.org/docs/user-guide/configuring

This is my code : https://codesandbox.io/s/vue-env-qi70n


Solution

  • In order to use environment variables you need to be using a container sandbox, so it has an actual server. Try using a template like Node and using Vue with it.

    There's more info on using secrets on CodeSandbox in our docs https://codesandbox.io/docs/secrets, as well as the difference between container and client sandboxes (https://codesandbox.io/docs/environment)