devtools icon indicating copy to clipboard operation
devtools copied to clipboard

setupDevtoolsPlugin method not worked sometime

Open pekonchan opened this issue 11 months ago • 3 comments

I write a plugin for devtools, when I use

import { setupDevtoolsPlugin } from '@vue/devtools-api'

setupDevtoolsPlugin({
    id:  'some_id',
    label: 'some_label',
    packageName: 'launch-editor',
    app,
  }, (api) => {
    console.log('🚀 ~ setupDevtools ~ api:', api)
    api.on.inspectComponent((payload, context) => {
      console.log('🚀 ~ setupDevtools ~ payload:', payload)
  })

Sometime the log does not print, but I refresh the page almost it can print.

Does devtools have caching ?

pekonchan avatar Jan 21 '25 08:01 pekonchan

I tried both 6.0.0-beta.11 and the latest version

pekonchan avatar Jan 21 '25 09:01 pekonchan

Can you provide a mini repo? 🙏

webfansplz avatar Jan 23 '25 02:01 webfansplz

Same here. I ran into a problem with vue-i18n not completing the plugin install in dev mode because setupDevtoolsPlugin never calling the callback function.

If I call createI18n in my "main" application.js like this, it works without a problem:

const i18n = createI18n({
  availableLocales: Object.keys(translations),
  locale,
  fallbackLocale: defaultLocale,
  messages: translations,
  globalInjection: true,
});
app.use(i18n);

But when i18n instance is created in another module setupDevtoolsPlugin never calls the callback:

// i18n.js

export const i18n = createI18n({
  availableLocales: Object.keys(translations),
  locale,
  fallbackLocale: defaultLocale,
  messages: translations,
  globalInjection: true,
});
//main.js

import {i18n} from './i18n.js'

app.use(i18n);

fdaugs avatar Feb 07 '25 16:02 fdaugs