nuxt / nuxt/devtools

help: plugin breaks devTools

Open
#907 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
TypeScript
Stars
3.3k
Forks
214
Avg merge
13h 22m
Merged PRs (30d)
18

Description

📚 What are you trying to do?

I have a project I'm upgrading from Nuxt v3 to v4. My app requires plugins that make the call to the CMS for intiial settings and Data etc. When I add my plugin

/* get global page data on start */
export default defineNuxtPlugin(async (nuxtApp) => {
  const siteSettingsStore = useSiteSettingsStore();
  await siteSettingsStore.fetchStoreSettings();

  const siteNavigation = useSiteNavigationStore();
  await siteNavigation.fetchStoreNavigation();

  // Add all the stores to the Nuxt context
  nuxtApp.provide("siteSettingsStore", siteSettingsStore);
  nuxtApp.provide("siteNavigation", siteNavigation);
});

to the app devTools is no longer available...

🔍 What have you tried?

Any change I make to the plugin code, namely adding app:created hook, or removing the async/await results the following error
"A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function."

ℹ️ Additional context

I also get the following error in the browser console.
"The resource http://localhost:3000/_nuxt/builds/meta/dev.json was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally."

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Nuxt v3-to-v4 upgrade with the shown async defineNuxtPlugin and CMS store calls, then inspect the devTools startup path when the composable error appears. Done means devTools loads while the plugin can fetch its initial settings and navigation without the reported Nuxt-instance error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.