slidev
slidev copied to clipboard
fix: consider basePath when generating slide URLs
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.
Deploy Preview for slidev failed.
| Name | Link |
|---|---|
| Latest commit | 9da4be98757401c88c328db4b0bd367d0c533397 |
| Latest deploy log | https://app.netlify.com/projects/slidev/deploys/6926185763095a00085e5f30 |
@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