PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, August 21, 2022

[FIXED] How to set custom path for dotenv in nuxt

 August 21, 2022     dotenv, environment-variables, javascript, nuxt.js, vue.js     No comments   

Issue

I have the following nuxt.config.js, where in the srcDir is pointing to "main-app" and I have placed the .env outside of it. So in the nuxt.config.js, how can set the custom path in line 1

require('dotenv').config({ path: '../.env' })

such that my process.env works enter image description here

Also the buildModules in nuxt.config.js is as follows

buildModules: ["@nuxtjs/fontawesome", "@nuxtjs/dotenv"],

Solution

Actually I need to set the live path of the env in the buildModules section just like follows

 buildModules: ["@nuxtjs/fontawesome", ['@nuxtjs/dotenv', { path: './' }]],


Answered By - Amaarockz
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing