Skip to content

wsUrl is always overwritten in dev mode — should respect user-defined config #3441

@maxilirator

Description

@maxilirator

Environment



Version

v3

Reproduction

https://jvmikmqoyw.github.stackblitz.io

Description

In @nuxt/content, the dev module sets runtimeConfig.public.content.wsUrl = listener.url.replace(...) unconditionally.

This makes it impossible to override wsUrl using nuxt.config.ts or hooks, as the value is always replaced during module init. Needed for non local dev installs.

Expected behavior:
If the user has already set public.content.wsUrl, the module should not overwrite it.

Suggested fix:

if (!nitro.options.runtimeConfig.public?.content?.wsUrl) {
  nitro.options.runtimeConfig.public.content.wsUrl = listener.url.replace("http", "ws")
}

happens in:

  • node_modules/@nuxt/content/dist/module.mjs
  • node_modules/@nuxt/content/dist/module.cjs

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions