I am trying to use env variables in my html markup to change env variables according to whether I am in production or development mode .. So for context using mixpanel I have two projects one for development and one for production with different api keys. how would I use webpack to do this, accessing my process.env.VUE_APP_MIXPANEL env variable in my html ?
If you are using the default Webpack template you can access the .env variables in index.html using this syntax (for example):
<html>
<head>
<title><%= VUE_APP_TITLE %></title>
</head>
<body>
...
</body>
</html>
Obviously you need to have a variable like this
VUE_APP_TITLE=My title
in your .env file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With