Static GitHub Issues

[1646] Can not access env variables on server side

prev: Simultaneous route transition
next: Nuxt Js while refreshing date picker is not working([vue-router] Failed to resolve async component default: SyntaxError: Unexpected token <)
// nuxt.config.js
build: {
  env: {
    VERSION: '1.0.0'
  }
}

// server/index.js
console.log(process.env.VERSION) // undefined

I can get the env variables in components, but i can't get env variables in server side code. I have try to resolve it with some transform plugins(like: babel-plugin-transform-define), because I'm using babel, but still not work.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1474">#c1474</a>)</em></sub></div>