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
Also the buildModules in nuxt.config.js is as follows
buildModules: ["@nuxtjs/fontawesome", "@nuxtjs/dotenv"],
Advertisement
Answer
Actually I need to set the live path of the env in the buildModules section just like follows
buildModules: ["@nuxtjs/fontawesome", ['@nuxtjs/dotenv', { path: './' }]],