Skip to content

Best way to use an environment variable in app.html? #9526

Discussion options

You must be logged in to vote

As of right now our solution was to use the webpack lodash syntax referenced in the vue cli docs. (even though this isn't a vue cli app I figured we are still using the htmlWebpackPlugin)

So we are doing this and it seems to be working. But, i'd like to upgrade to vite when vue 3 is out and i'm not sure that will be supported. So my question remains in nuxt > 2.13 how do you use env variables in app.html?

<script>
somescript.load('<%= process.env.SCRIPT_KEY %>')
</script>

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kissu
Comment options

@DerekAlanGilbert
Comment options

@manniL
Comment options

Answer selected by DerekAlanGilbert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants