vite.config: optimize memory and fix symlink loop#23
Conversation
c3707bf to
ca45381
Compare
ae74262 to
718bc58
Compare
ca45381 to
afa8537
Compare
Add test infrastructure for validating slidev-template features: - playwright.config.ts: Playwright test configuration - tests/smoke.spec.ts: Validates render-slides.sh and gen_slides.sh - tests/visual-regression.spec.ts: Screenshot comparison for layouts Tests cover PR #22 (docker helpers) and PR #23 (vite memory fixes): - Dev server startup validation - Symlink creation for /slides/ paths - Memory limit handling - Visual regression for slide layouts Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
f491e8a to
ae8bb22
Compare
718bc58 to
6ec86f7
Compare
|
Those are partially recommended partially AI-researched changes. I was using those changes for quite some time without any memory issues or loops for various sizes of presentations. So question what should be an evidence here to merge this? |
|
Does polling has to be disabled? I need to restart whole slidev to see updated slides, unless there is better method? |
It really depends on the change, methods I use for refresh:
I'm not sure in what part of developer workflow you see the effect you mention. |
Even simple letter change requires me to restart slidev (point 2) |
Add Playwright test that modifies slide content on disk and verifies the browser picks up the change without a manual page reload. This addresses m-iwanicki's review on PR #23 where usePolling: false broke HMR. The previous commit removes the explicit usePolling setting, letting Vite auto-detect. This test ensures HMR keeps working. Mount test-repo volume into Playwright container so the HMR test can write to the slide file that the dev server watches. Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
6ec86f7 to
2112c55
Compare
|
@m-iwanicki I tried to fix and validated what you see. I added tests to make sure feature will not regress: |
Add Playwright test that modifies slide content on disk and verifies the browser picks up the change without a manual page reload. This addresses m-iwanicki's review on PR #23 where usePolling: false broke HMR. The previous commit removes the explicit usePolling setting, letting Vite auto-detect. This test ensures HMR keeps working. Mount test-repo volume into Playwright container so the HMR test can write to the slide file that the dev server watches. Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
2112c55 to
4a079d5
Compare
|
Hmmm, still doesn't work for me, even opened slide in new browser just to make sure it's not cache fault. How I tested it:
Results: No changes, not even when refreshing or opening slides in new browser. |
- Disable HMR error overlay to reduce memory consumption - Add file watching optimizations (disable polling, 1s interval) - Ignore slides/tools/** and slides/slidev-template/** patterns to prevent infinite symlink loop in file watcher (ELOOP errors) - Configure vendor chunk splitting to reduce memory pressure - Exclude @slidev/cli from pre-bundling optimization - Add build-time rollup optimizations for chunking scripts/render-slides: expose GC API for better memory management - Add --expose-gc to NODE_OPTIONS to allow manual garbage collection - Helps Vite/Slidev plugins manage memory more effectively These changes address memory exhaustion issues when running Slidev dev server with Vite 7, which has known HMR memory leaks. Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
Add Playwright test that modifies slide content on disk and verifies the browser picks up the change without a manual page reload. This addresses m-iwanicki's review on PR #23 where usePolling: false broke HMR. The previous commit removes the explicit usePolling setting, letting Vite auto-detect. This test ensures HMR keeps working. Mount test-repo volume into Playwright container so the HMR test can write to the slide file that the dev server watches. Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
Add vite-config-hmr-disabled.ts fixture that sets hmr: false in vite.config.ts. When applied, the HMR test correctly fails, proving it detects when file changes stop propagating to the browser. Verified: ./scripts/run-tests.sh broken hmr → PROOF COMPLETE Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
The `slides -> ..` symlink causes chokidar to report file changes through recursive symlink-traversed paths instead of canonical paths. Setting `followSymlinks: false` ensures Slidev's watchFiles map matches the reported paths, fixing HMR for external files. Also adds test-hmr-external.sh that reproduces the real developer workflow (host file edit -> Docker dev server -> browser HMR) and reduces broken fixture test verbosity (quiet on pass, verbose on fail). Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
sed -i and git checkout replace file inodes, causing chokidar's inotify watches to break on subsequent edits. Polling via fs.stat() is immune to inode changes and is the standard Docker workaround. Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
|
@m-iwanicki @macpijan I did it one more time, tested carefully:
Test results: |
4a079d5 to
a17cdee
Compare
macpijan
left a comment
There was a problem hiding this comment.
@pietrushnic It works the same for me. I get instant change in Firefox browser when changing sources as you do in your scenario.
|
Tets pass for me as well just fine. |
Yes, now it works 👍 |



scripts/render-slides: expose GC API for better memory management
These changes address memory exhaustion issues when running Slidev dev server with Vite 7, which has known HMR memory leaks.