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

feat: add env-flag for env-specific config (#357) #424

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tillsanders
Copy link

This PR is proposing to add a new --env [name] attribute to Nuxi. The attribute will be passed to the envName option of the c12 library. This adds the ability to support environment overrides (environment-specific configuration) for custom environments. Currently, c12 supports that and the types of the nuxt configuration file are aware of that, but there is no way to actually use custom environments, because NODE_ENV cannot be set to values other than production or development. This PR closes the gap, making deployments to different environments easier.

See #357.

Should this be approved, I would be happy to amend the documentation accordingly.

@MickL
Copy link

MickL commented Jul 20, 2024

Does this PR also apply for the environment overrides set in nuxt.config.ts? So if I set --env preview it will pick up the second one?

export default defineNuxtConfig({
   $production: {
       ignore: ['app/pages/dev'],
       scripts: {
         registry: {
           cloudflareWebAnalytics: true,
         },
       },
   },
   $preview: {
        ignore: ['app/pages/dev'],
   },
});

src/commands/build.ts Outdated Show resolved Hide resolved
tillsanders added a commit to tillsanders/nuxt that referenced this pull request Sep 10, 2024
Documentation accompanying the PR for Nuxt CLI: nuxt/cli#424 (currently in review)
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

Successfully merging this pull request may close these issues.

3 participants