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 reacting to html updates #23

Open
kiyoshi-satoo opened this issue Aug 9, 2023 · 5 comments
Open

Not reacting to html updates #23

kiyoshi-satoo opened this issue Aug 9, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@kiyoshi-satoo
Copy link

kiyoshi-satoo commented Aug 9, 2023

Vite doesn't detect html changes and page(Browser) not reloading(No HMR request).
My code same as on documentation ( postHtml example )

import vituum from "vituum";
import posthtml from "@vituum/vite-plugin-posthtml";

export default {
  plugins: [
    vituum(),
    posthtml({
      root: "./src",
    }),
  ],
  build: {
    rollupOptions: {
      input: ["./src/pages/**/*.html"],
    },
  },
};

@kiyoshi-satoo
Copy link
Author

if someone faced this problem - just update Vite to the latest version.It's worked for me

@kiyoshi-satoo
Copy link
Author

all the same, this is definitely bugged at times. Sometimes the page does not react at all to changes

@nawafinity
Copy link

Hello @kiyoshi-satoo
I am experiencing a similar issue; however, I have developed my own plugin to reload the entire page upon detecting any changes. This is merely a temporary solution until the issue is resolved.

vite.config.js

...
    plugins: [
        vituum(),
        posthtml({
            root: "./src",
        }),

        // Custom HMR
        {
            name: "custom-hmr",
            enforce: "post",
            handleHotUpdate({file, server}) {
                if (file.endsWith(".html")) {
                    server.ws.send({
                        type: "full-reload",
                        path: "*"
                    })
                }
            }
        }
    ],
...

@lubomirblazekcz
Copy link
Member

Hey @nawafinity @kiyoshi-satoo that should indeed fix it. I forgot to include hmr in posthtml plugin, will fix this soon 👍

@kiyoshi-satoo
Copy link
Author

Hi, @nawafinity .Thanks for the answer. It helped

@lubomirblazekcz lubomirblazekcz added the bug Something isn't working label Aug 23, 2023
@lubomirblazekcz lubomirblazekcz self-assigned this Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants