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

Allow specific names in publicRuntimeConfig #9074

Closed
ivodolenc opened this issue Mar 30, 2021 · 2 comments · Fixed by #9075
Closed

Allow specific names in publicRuntimeConfig #9074

ivodolenc opened this issue Mar 30, 2021 · 2 comments · Fixed by #9075

Comments

@ivodolenc
Copy link

Hi and thanks for your work on Nuxt.

Request

As I mentioned in the official Nuxt Discord, can you please consider allowing users to use words/names such as app in project configuration?

It's short, strong meaning and definitely one of the most common for a configuration within a project. I think this approach that doesn't allow the use of such common names in the project configuration can be very confusing and problematic for debugging.

Code example

This worked fine until version 2.15.0, so it's kind of a breaking-change:

// nuxt.config.js

export default {
  publicRuntimeConfig: {
    // Doesn't work after version '2.14.12'
    app: {
      title: 'New Title',
      titleSeparator: '-',
      titleTemplate: 'Title Template',
      description: 'New Description',
    },
  },
}

Suggestion

As Daniel said in Discord chat:

Nuxt is using the app namespace for internal dynamic config.

It might make more sense to use alternatives under the hood (in Nuxt core such as _app or __app) and allow users to use the normal versions (such as app).

Other examples

This is allowed in Next.js.

@danielroe
Copy link
Member

danielroe commented Mar 30, 2021

Related: #9039.

I think this is reasonable (using _app for Nuxt internal namespace to prevent collisions).

@ivodolenc
Copy link
Author

Awesome 👍 This will be available in the next release, right?

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

Successfully merging a pull request may close this issue.

2 participants