Skip to content

exportFilename generates PDF outside dist folder and creates incorrect download links #2312

@RobertoBochet

Description

@RobertoBochet

Describe the bug

Hi, I recently started using sli.dev and encountered what I believe might be a bug with the PDF generator during the build process.

When I set a custom name for the PDF using exportFilename and run the build script, the PDF is generated outside the dist folder (although the link in the slides correctly points to the right path). This behavior only occurs when using a custom name; removing exportFilename makes the PDF appear in the dist directory as expected.

When I tried to include the dist directory in the exportFilename value, the file was correctly placed in the dist folder, but the link in the slides became broken, pointing to /dist/{pdf_filename}.pdf.

Is this a bug or known behavior?

Steps to Reproduce

  1. npm create slidev
  2. Add to the slides.md frontmatter:
    download: true
    exportFilename: example-file
  3. Install playwright-chromium (npm i -D playwright-chromium)
  4. Run npm run build
  5. Observe that example-file.pdf is created in the project root instead of the dist folder

Environment

  • Slidev version: 52.5.0
  • Playwright Chromium version: 1.56.1
  • Node version: 20.19.5 | 22.21.0
  • OS: Arch Linux with bun and npm

EDIT:

I tried to reproduce this bug in this repo.

Steps to Reproduce

  1. Clone this repo
  2. Run pnpm install
  3. Add to the demo/starter/slides.md frontmatter:
    download: true
    exportFilename: example-file
  4. Run pnpm demo:build
  5. Observe that example-file.pdf is created in demo/starter instead of the docs/.vitepress/dist/demo/starter folder

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions