nanostores / vue

Vue integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores
MIT License
47 stars 5 forks source link

Integration nanostores DevTools with Vue as an island in Astro fails #11

Open hipertracker opened 6 months ago

hipertracker commented 6 months ago

I am using the Astro framework with Vue and nanostores integrations. All is working fine, except I cannot see nanostores Devtools. They are not displayed (out of the box) under Astro DevTools or Vue Devtools.

I guess must add nanostores DevTools as the Vue plugin with the app. use() command. The problem is that the Astro-Vue integration uses a TypeScript file on the server side, so nanostores DevTools can't be added there. Any hints?

This is my repo https://github.com/hipertracker/astro-primevue-minimal

euaaaio commented 6 months ago

I still haven't tried Nanostoes Devtools with Astro. What error do you see in console logs?

euaaaio commented 6 months ago

Nanostores are written in pure JS with declaration types (.d.ts files) without bundling or building. If Nanostores works, devtools should also works.

I'm going to assume that the problem is in the versions of the installed packages. We don't yet support “next” Vue Devtools. Try to use @vue/devtools-api version 6.5.1.

euaaaio commented 6 months ago

Just tested in your repo. It works.

import PrimeVue from 'primevue/config';
import type {App} from 'vue';

import { devtools } from '@nanostores/vue/devtools'

import 'primeicons/primeicons.css'
import { mainStore } from '../stores/main_store';

export default (app: App) => {
    app.use(PrimeVue);
    app.use(devtools, { mainStore });
};
image
hipertracker commented 6 months ago

Have you tried it under Astro integration, inside _app.ts file?

When I add import {devtools} from '@nanostores/vue/devtools'

it fails with

...node_modules/.pnpm/@nanostores+vue@0.10.0_@nanostores+logger@0.2.4_@vue+devtools-api@7.0.8_nanostores@0.9.5_vue@3.4.10/node_modules/@nanostores/vue/devtools/index.js:2 import { setupDevtoolsPlugin } from '@vue/devtools-api' ^^^^^^^^^^^^^^^^^^^ SyntaxError: The requested module '@vue/devtools-api' does not provide an export named 'setupDevtoolsPlugin'

I think this is because that import is executed on the server

hipertracker commented 6 months ago

I still haven't tried Nanostoes Devtools with Astro. What error do you see in console logs?

SyntaxError: The requested module '@vue/devtools-api' does not provide an export named 'setupDevtoolsPlugin'

euaaaio commented 6 months ago

Yeah, yeah. That's exactly what I wrote about. Try to install @vue/devtools-api version 6.5.1.

hipertracker commented 6 months ago

Yeah, yeah. That's exactly what I wrote about. Try to install @vue/devtools-api version 6.5.1.

OK. This is fine now. There must be an issue in API v7.

euaaaio commented 6 months ago

I will not close the issue just yet. Will try to implement new devtools support this month.