Custom VUE_APP_ / environment variables issue

I need to set custom VUE_APP_ environment variables like described in or through webpack DefinePlugin, but these two methods dont work on framework7 (latest) project created with f7-cli.

Does anyone have any suggestions?


App created with F7 CLI already has these NODE_ENV variables set

I think you are misunderstanding the issue, I stumbled upon the same problem for a React app built with F7-CLI. We would like to set our own environment variables, such as API keys, but I tried with a .env file and that’s not working. Any help? Thanks!

He is asking for custom variables, not NODE-ENV and PUBLIC_URL, need this help for my degree final project, thanks!

If you use webpack bundler open your webpack config and look for this code:

new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(env),
      'process.env.TARGET': JSON.stringify(target),

You can add any variables here

1 Like

Yes, I found out this method but, likewise, it isn’t a good practice neither since the environment variables continues staying in the repo. What I want to do is to read properties from my .env file or my system. Is this possible? If not, tell me and I won’t waste my time with this anymore! Thank you so much :slight_smile:

You can extend your webpack config file to read the env file and use it from there, can’t see any problems

1 Like

That’s what I’m looking for! If you know how I would be very grateful! Anyways, thank you so much!

I am sure you can find a lot of info on how to read files in Node.js on the web, e.g.