slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
32.63k stars 1.31k forks source link

Two dev servers on the same port cause setup functions wrongly loaded #1830

Open ChristopherWMM opened 3 weeks ago

ChristopherWMM commented 3 weeks ago

Describe the bug

Sometimes, the initial run of the dev preview does not load custom code-runner implementations.

Minimal reproduction

Steps to reproduce the behavior:

  1. Execute npm run dev while having VSCode extension preview tab active
  2. Attempt to manually run / auto-run a non-standard monaco runner
  3. See Error: Runner for language "<lang>" not found on one of the presentations (in-editor or in-browser)

See slidev-code-runner for an example with a custom Python implementation in ./setup/code-runners.ts

Environment

Notes

This issue only occurs sometimes on the initial load of the dev preview, any subsequent loads after making edits to the project are fine. The built version of the project also appears to be fine.

KermanX commented 3 weeks ago

Are there two Slidev servers running at the same time, and on the same port?

ChristopherWMM commented 3 weeks ago

Are there two Slidev servers running at the same time, and on the same port?

Yes! Your question made me realize that I had the in-browser tab that pops up when starting the dev server AND the VSCode Slidev extension preview active at the same time. During my testing yesterday, I did not have the preview tab opened in VSCode and it worked fine. I just tried it again with the VSCode preview window open in my editor and one of the presentation instances (looks like the first one to load) encounters the Error: Runner for language "<lang>" not found error.

I edited the original issue post's replication instructions to reflect this new information.