Skip to content

Conversation

@coaxial
Copy link
Contributor

@coaxial coaxial commented Nov 25, 2025

Hello,

This fixes an issue with the presenter when using build --base=/path/ where the presenter will instead generate slide links as /<slide number> instead of /path/<slide number>.

I've added a test as well but getting this error when trying to run the test suite:

$ pnpm test

> @52.9.1 test /home/pierre/code/slidev
> vitest test


 DEV  v4.0.8 /home/pierre/code/slidev

 ✓ test/transform-magic-move.test.ts (2 tests) 537ms
   ✓ basic  381ms
 ✓ test/parser.test.ts (74 tests) 114ms
 ✓ packages/parser/src/timesplit/timesplit.test.ts (1 test) 16ms
 ✓ test/transform.test.ts (8 tests) 18ms
 ✓ packages/parser/src/timesplit/timestring.test.ts (2 tests) 9ms
 ✓ test/transform-all.test.ts (1 test) 12ms

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  test/utils.test.ts [ test/utils.test.ts ]
Error: Cannot find module '#slidev/slides' imported from '/home/pierre/code/slidev/packages/client/logic/slides.ts'
 ❯ packages/client/logic/slides.ts:2:24
      1| import type { SlideRoute } from '@slidev/types'
      2| import { slides } from '#slidev/slides'
       |                        ^
      3| import { computed, watch, watchEffect } from 'vue'
      4| import { useNav } from '../composables/useNav'
 ❯ test/utils.test.ts:4:1

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯


 Test Files  1 failed | 6 passed (7)
      Tests  88 passed (88)
   Start at  21:40:47
   Duration  1.99s (transform 557ms, setup 0ms, collect 1.29s, tests 706ms, environment 2ms, prepare 66ms)

I haven't changed this import and without my patch (i.e. just after cloning), the tests run fine.

@netlify
Copy link

netlify bot commented Nov 25, 2025

Deploy Preview for slidev failed.

Name Link
🔨 Latest commit 9da4be9
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6926185763095a00085e5f30

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 25, 2025

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2384

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2384

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2384

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2384

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2384

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2384

commit: 9da4be9

@coaxial coaxial changed the title Consider basePath when generating slide URLs fix: consider basePath when generating slide URLs Nov 25, 2025
import type { ResolvedFontOptions, SlideInfo, SlideRoute } from '@slidev/types'
import { relative, resolve } from 'node:path'
import { slash } from '@antfu/utils'
import { getSlidePath } from '@slidev/client/logic/slides'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in client environment that relies on virtual modules; we can't directly test it in this file like this. We might want to extract this logic to test spareately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants