title: Vue.js: Defining computed environment variables in vue.config.js (vue cli 3)
body: <p>The documentation for Vue CLI 3 says here <a href="https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code" rel="noreferrer">https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code</a>:</p>
  
  <blockquote>
    <p>You can have computed env vars in your <code>vue.config.js</code> file. They still need to be prefixed with <code>VUE_APP_</code>. This is useful for version info <code>process.env.VUE_APP_VERSION = require('./package.json').version</code></p>
  </blockquote>
  
  <p>This is exactly what I want to do. But I couldn't find out how to actually define the env var there in <code>vue.config.js</code>. I tried:</p>
  
  <pre class="lang-js prettyprint-override"><code>module.exports = {
      process.env.VUE_APP_VERSION: require("../package.json").version,
      ...
  }
  </code></pre>
  
  <p>But it just produces an error:</p>
  
  <pre><code>ERROR  SyntaxError: Unexpected token .
      /Users/lhermann/htdocs/langify/frontend/vue.config.js:2
      process.env.VUE_APP_VERSION: require("../package.json").version,
             ^
  </code></pre>
  
  <p>Does anyone know?</p>