Skip to content

feat(preset): warn if nuxthub is loaded before without database #3405

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

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

Conversation

huang-julien
Copy link
Member

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR adds and addtionnal check when using nuxt content with nuxthub.

In cases when nuxt content is after nuxthub and nuxthub doesn't have databse enabled, deploying on nuxthub won't update the DB. Because the modification brought to nuxt.options.hub done too late.

export default defineNuxtConfig({
  modules: [
    '@nuxthub/core', // nuxt content should load before nuxthub or the user should enable databse themselves
    "@nuxt/content",
  ]
})

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@huang-julien huang-julien changed the title feat: warn if nuxthub is loaded before without database feat(preset): warn if nuxthub is loaded before without database Jun 14, 2025
Copy link

cloudflare-workers-and-pages bot commented Jun 14, 2025

Deploying content with Β Cloudflare Pages Β Cloudflare Pages

Latest commit: eb6c97b
Status:Β βœ…Β  Deploy successful!
Preview URL: https://2033bdee.content-f0q.pages.dev
Branch Preview URL: https://fix-nuxthub-warn.content-f0q.pages.dev

View logs

Copy link

pkg-pr-new bot commented Jun 14, 2025

npm i https://pkg.pr.new/@nuxt/content@3405

commit: eb6c97b

@huang-julien huang-julien requested a review from farnabaz June 14, 2025 20:09
const indexOfNuxtHub = nuxt.options.modules.indexOf('@nuxthub/core')
const indexOfContentModule = nuxt.options.modules.indexOf('@nuxt/content')

if (!((nuxt.options as unknown as { hub: { database?: boolean } }).hub?.database) && indexOfNuxtHub > indexOfContentModule) {
Copy link
Member

Choose a reason for hiding this comment

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

This should be indexOfNuxtHub < indexOfContentModule

Copy link
Member Author

Choose a reason for hiding this comment

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

oops 🀦

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.

2 participants