Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hot reloading not working #1092

Closed
vim-daniel opened this issue Aug 23, 2023 · 8 comments · Fixed by #1094
Closed

hot reloading not working #1092

vim-daniel opened this issue Aug 23, 2023 · 8 comments · Fixed by #1094
Labels
bug:upstream bug Something isn't working help wanted Extra attention is needed hmr

Comments

@vim-daniel
Copy link

vim-daniel commented Aug 23, 2023

Describe the bug
When running slidev with latest versions - hot reloading is not working..

in an older version (0.35~) it seems to work

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://stackblitz.com/edit/slidev-fqfsw2?file=slides.md
  2. Change slides.md
  3. page is not updated with the content

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Slidev version: latest (0.42.9)
@lili21
Copy link

lili21 commented Aug 23, 2023

run into the same issue.

@Wxh16144
Copy link

Same question that's been bothering me.

@antfu
Copy link
Member

antfu commented Aug 23, 2023

I can confirm it's the case on Stackblitz, but it's working fine on my local machine. Haven't had time to dig deeper, before I work on it, any help on investigating or providing more info are appreciated

@antfu antfu added bug Something isn't working help wanted Extra attention is needed hmr labels Aug 23, 2023
@lili21
Copy link

lili21 commented Aug 24, 2023

@antfu I am running on a local machine, it doesn't work.

macOS Ventura
Chorme
@slidev/cli@0.42.9

@Wxh16144
Copy link

Provide some information about me to easily reproduce the problem. I don't have time to help with the investigation either

Details

System:
OS: macOS 13.4
CPU: (10) arm64 Apple M1 Pro
Memory: 76.00 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.20.0/bin/yarn
npm: 8.19.4 - ~/.nvm/versions/node/v16.20.0/bin/npm
pnpm: 8.2.0 - ~/.nvm/versions/node/v16.20.0/bin/pnpm
Watchman: 2023.03.27.00 - /opt/homebrew/bin/watchman
Managers:
Cargo: 1.70.0 - ~/.cargo/bin/cargo
CocoaPods: 1.12.0 - /opt/homebrew/bin/pod
Homebrew: 4.1.5 - /opt/homebrew/bin/brew
pip3: 22.3.1 - /opt/homebrew/bin/pip3
RubyGems: 3.0.3.1 - /usr/bin/gem
Utilities:
Make: 3.81 - /usr/bin/make
GCC: 14.0.3 - /usr/bin/gcc
Git: 2.40.0 - /opt/homebrew/bin/git
Clang: 14.0.3 - /usr/bin/clang
Curl: 7.88.1 - /usr/bin/curl
Servers:
Apache: 2.4.56 - /usr/sbin/apachectl
Virtualization:
Docker: 20.10.13 - /usr/local/bin/docker
IDEs:
VSCode: 1.81.1 - /usr/local/bin/code
Vim: 9.0 - /usr/bin/vim
Xcode: /undefined - /usr/bin/xcodebuild
Languages:
Bash: 3.2.57 - /bin/bash
Go: 1.18 - /usr/local/go/bin/go
Perl: 5.30.3 - /usr/bin/perl
PHP: 8.2.4 - /opt/homebrew/bin/php
Python3: 3.11.2 - /opt/homebrew/bin/python3
Ruby: 2.6.10 - /usr/bin/ruby
Rust: 1.70.0 - /Users/wuxh/.cargo/bin/rustc
Databases:
SQLite: 3.39.5 - /usr/bin/sqlite3
Browsers:
Chrome: 115.0.5790.98
Safari: 16.5


➜ pnpm list
Legend: production dependency, optional only, dev only

/Users/wuxh/Code/SelfProject/my-talks/components-dev (PRIVATE)

dependencies:
@slidev/cli 0.42.9
@slidev/theme-default 0.21.2
@slidev/theme-seriph 0.21.3

devDependencies:
@iconify-json/logos 1.1.34

@hrmJ
Copy link

hrmJ commented Aug 25, 2023

I actually do see vite outputting "hot reloaded" in the console, but no changes are actually reflected in the dom

@antfu
Copy link
Member

antfu commented Aug 26, 2023

Identified that this issue is introduced in the transcendent dependency @vitejs/plugin-vue@4.3.2, specifically these two commits:

It's because the Vue plugin now assumes HMR should work on an existing file, while Slidev provides them as virtual modules.

try {
const md = await transformMarkdown((await (<any>MarkdownPlugin.transform)(newData.slides[i]?.content, file)).code, i, newData)
const handleHotUpdate = 'handler' in VuePlugin.handleHotUpdate! ? VuePlugin.handleHotUpdate!.handler : VuePlugin.handleHotUpdate!
return await handleHotUpdate({
...ctx,
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
file,
read() { return md },
})
}

/cc @sxzz Any idea this could be fixed either on Slidev or plugin-vue?


A temporary workaround is to pin the version of @vitejs/plugin-vue back to 4.3.1 by adding the following lines to your package.json

  "resolutions": {
    "@vitejs/plugin-vue": "4.3.1"
  }

Edit: Or you can upgrade to @slidev/cli@^0.42.10, which pinned @vitejs/plugin-vue in dependencies

antfu added a commit that referenced this issue Aug 26, 2023
@sxzz
Copy link
Contributor

sxzz commented Aug 26, 2023

I'm investigating this

@sxzz sxzz mentioned this issue Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:upstream bug Something isn't working help wanted Extra attention is needed hmr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants