Description
Describe the bug
When using additional component resolvers, the application becomes blank after a while, with the following browser console errors:
[Vue warn]: injection "Symbol(router)" not found.
[Vue warn]: injection "Symbol(route location)" not found.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'currentRoute')
This is very weird problem. Sometimes the slides work fine, everything including the PrimeVue components are displayed correctly, but after a few seconds app div will become blank. Sometimes the slides don't load at all.
Minimal reproduction
Note that this problem is not reproduced consistently. Here's what my customization looks like:
// main.ts
import { defineAppSetup } from "@slidev/types";
import PrimeVue from "primevue/config";
import Aura from "@primevue/themes/aura";
export default defineAppSetup(({ app }) => {
// TODO: support specifying themes in head matter
app.use(PrimeVue, {
theme: {
preset: Aura,
options: {
// PrimeVue uses system dark mode selector by default, which conflicts
// with the toggle in Slidev
darkModeSelector: ".dark"
}
},
});
});
/// <reference types="@slidev/types" />
import { defineConfig } from "vite";
import { PrimeVueResolver } from "@primevue/auto-import-resolver";
export default defineConfig({
slidev: {
components: {
resolvers: [PrimeVueResolver()],
},
},
});
- Install the addon using
npm install slidev-addon-prime
- Add the addon to
slides.md
:
---
addons:
- prime
---
- (optional) add some PrimeVue components
<div class="card flex justify-center flex-wrap gap-4">
<Button label="Primary" />
<Button label="Secondary" severity="secondary" />
</div>
- Run
slidev
.
Potential Causes
Interference between the router injection and other resolvers.