Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env.dev file is not working in nuxt plugin #73

Open
ChoWonmin opened this issue Oct 14, 2022 · 1 comment
Open

.env.dev file is not working in nuxt plugin #73

ChoWonmin opened this issue Oct 14, 2022 · 1 comment

Comments

@ChoWonmin
Copy link

Hello.

.env.dev file is not working in nuxt plugin.

i created .env.dev file and run script "nuxt --dotenv .env.dev".
print env variable in my custom nuxt plugin.
console.log(process.env) #output :: {}

But .env file is working.

@prashantnirgun
Copy link

prashantnirgun commented Jan 10, 2023

not working with nuxt3

nuxt.config.js is as follows

import { defineNuxtConfig } from "nuxt/config"
export default defineNuxtConfig({
    css : ['vuetify/lib/styles/main.sass', '@mdi/font/css/materialdesignicons.min.css'],
    modules: [
        ['@nuxtjs/dotenv', { filename: '.env.development' }]
      ],    
    runtimeConfig: {
        apiSecret: '123',
        public: {
            SITE_NAME: process.env.SITE_NAME || 'Ghost'
        }
      },
    build : {
        transpile :[
            'vuetify',
        ]
    },
    vite : {
        define : {
            'process.env.DEBUG' : false,
        }
    }

})

.env.development file present in source directory but it give error as follows

 ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'srcDir')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants