Can not access env variables from plugin
[issue link]I set in nuxt.config.js env variables
env: {
language: process.env.NODE_LOCALE
},
and after, when plugin code runs in server I get undefined.
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
export default ({ app, isServer, env }) => {
app.i18n = new VueI18n({
locale: env.language || 'en', #env.language === undefined
fallbackLocale: env.language || 'en',
messages: {
'en': require('~/locales/en.json'),
'es': require('~/locales/es.json'),
'fr': require('~/locales/fr.json'),
'de': require('~/locales/de.json')
}
})
I read doc several times but I can’t find a solution.
Edit(more info):
On my laptop(mac) works fine in dev and production mode, but in ubuntu 14.04 server is where stops working.
Edit2:
I found my mistake, I wasn’t exporting correctly variables before build. Please close the issue and sorry for the inconvenience.