[Vuejs]-.env Nuxt JS doesn't resolve routes in generate option correctly

0👍

You should use dotenv module:

https://www.npmjs.com/package/dotenv

More Info about configuration with NUXT you have here:

https://samuelcoe.com/blog/nuxt-dotenv/

You probably want to set your env property in nuxt.config.js, for example:

module.exports = {
  env: {
    BLOG_API: process.env.BLOG_API_URL,
  },

In your component, you can now use them :

      makeAsyncCall({
        to: process.env.BLOG_API,
      })

Leave a comment