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

nuxt cli --dotenv flag not honored #672

Closed
joel-wenzel opened this issue Dec 19, 2022 · 2 comments
Closed

nuxt cli --dotenv flag not honored #672

joel-wenzel opened this issue Dec 19, 2022 · 2 comments

Comments

@joel-wenzel
Copy link

Environment


  • Operating System: Windows_NT
  • Node Version: v16.17.0
  • Nuxt Version: 2.16.0-27720022.54e852f
  • Nitro Version: 1.0.0
  • Package Manager: [email protected]
  • Builder: webpack
  • User Config: typescript, alias, bridge, nitro, ssr, render, target, imports, loading, head, css, srcDir, plugins, components, buildModules, i18n, modules, publicRuntimeConfig, axios, router, vuetify, build, ignore, serverHandlers, devServerHandlers, devServer
  • Runtime Modules: @nuxtjs/[email protected],
    @nuxtjs/[email protected]
  • Build Modules: (), @pinia/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxt/[email protected]------------------------------

Reproduction

Not needed ( i dont think )

Describe the bug

nuxi commands always use the default .env file even if the --dotenv arg is specified

Additional context

I think the right spot for the fix is @nuxt/config-edge src/load.js loadNuxtConfig

With nuxi the incoming env config has the following pattern:

{
  cwd: 'C:/code/Tempest/flexdeploy',        
  fileName: 'production.env'
}

which is the spread here:

envConfig = {
    dotenv: ".env",
    env: process.env,
    expand: true,
    ...envConfig
  };

Just changing to dotenv: envConfig.fileName ?? ".env" does the trick

Logs

No response

@joel-wenzel
Copy link
Author

I can submit a PR for this as long as this seems like the right spot

@danielroe danielroe mentioned this issue Jun 20, 2023
@wattanx
Copy link
Collaborator

wattanx commented Jul 30, 2023

The --dotenv flag is working in the latest version, so this issue is closed.

@wattanx wattanx closed this as completed Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants