devtools icon indicating copy to clipboard operation
devtools copied to clipboard

help: plugin breaks devTools

Open MartyNZ opened this issue 1 month ago • 1 comments

📚 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."

MartyNZ avatar Nov 10 '25 03:11 MartyNZ

We will need a reproduction to know what happend

antfu avatar Nov 10 '25 04:11 antfu