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

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

tillsanders
Copy link
Contributor

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)
@tillsanders
Copy link
Contributor Author

I added a commit to address the feedback above. Is there anything else I can do to improve this pull request?

src/commands/_shared.ts Outdated Show resolved Hide resolved
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than usage, looks good to me

@pi0 pi0 requested a review from danielroe October 7, 2024 08:47
@danielroe danielroe merged commit d24f287 into nuxt:main Oct 15, 2024
3 checks passed
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.

4 participants