admin管理员组文章数量:1305592
I have set environment variables in AWS Amplify, with the VUE_APP_ prefix, but they aren't loading on production. Locally, they're pulled in fine from a .env file.
Here's an example of a variable in Amplify:
And here's where I'm using it in app.vue:
seoMeta(
`${import.meta.dev ? '(Local) ' : ''} ${process.env.VUE_APP_META_TITLE}`,
process.env.VUE_APP_META_DESCRIPTION,
process.env.VUE_APP_META_IMAGE
);
However, I have found that the variables are imported fine inside nuxt.config.js:
$production: {
scripts: {
registry: {
googleAnalytics: true
}
},
runtimeConfig: {
public: {
scripts: {
googleAnalytics: {
id: process.env.VUE_APP_GOOGLE_TAG_ID
},
},
},
}
},
So it's just loading inside the component that's causing an issue.
Is there something else I need to do to wire it all up?
本文标签: vuejsWhy are Amplify environment variables not loading in my VueNuxt componentStack Overflow
版权声明:本文标题:vue.js - Why are Amplify environment variables not loading in my VueNuxt component? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741803817a2398378.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论