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

Not possible to cancel full reload via vite:beforeFullReload in 5.2.13 #17447

Closed
7 tasks done
hiber-stefan opened this issue Jun 12, 2024 · 3 comments
Closed
7 tasks done
Labels
duplicate This issue or pull request already exists

Comments

@hiber-stefan
Copy link

Describe the bug

We use vite for a react-like dev environment. Key for us is to be able to stop full reloads, as we manage reloads ourselves via custom plugins. Up until now, we have been able to cancel full reload with this:

     if (import.meta.hot) {
              import.meta.hot.on('vite:beforeFullReload', (payload) => {
                throw '(skipping full reload)';
              });

              import.meta.hot.accept(() => {
                console.info('Hot reload: updated ${path.basename(id)}');
                import.meta.hot.invalidate();
              });
          }

This has now stopped working; reverting back to 5.1.7 makes the use case work again.

We have inspected the event code in vite, but can see no obvious local current change that would explain this.

Reproduction

https://stackblitz.com/edit/vitejs-vite-kdguwf

Steps to reproduce

  • npm install
  • add custom HMR code to stop full reload
  • npm run dev
  • change code

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M3
    Memory: 161.75 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
    pnpm: 8.15.8 - ~/.nvm/versions/node/v18.18.2/bin/pnpm
  Browsers:
    Chrome: 125.0.6422.144
    Safari: 17.5

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented Jun 12, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@kaiyoma
Copy link

kaiyoma commented Jul 31, 2024

We are also running into this. Full page reloads when developing are very disruptive, and up until now we've been suppressing those reloads with code adapted from here: #5763 (comment)

@sapphi-red
Copy link
Member

IIUC this was never a intended behavior. Closing as a duplicate of #5763

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2024
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Aug 21, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants