windsonR / vite-plugin-virtual-html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.1.6 somehow kills routing

krossekrabbe opened this issue · comments

commented

Hi, I have this config

    virtualHtml({
      pages: {
        index: "/public/vite.index.html",
      },
      indexPage: "index",
    }),

And in my app some react-router routes like this

        <Route
          path="/logout"
          component={() => ........ }
        />

After upgrading to 1.1.6 I can only access the root route like https://localhost/, but any other route like https://localhost/logout is not working anymore, vite returns a 404 Not Found immediately for these URLs. With version 1.1.5 it is working like ever before.

That's weird, because if your url has no .htmlor end with /, It will not transformed by plugin.
Please provide a reproduced repo.

commented

@windsonR Please try this stripped-down version of my project:

git clone https://github.com/krossekrabbe/vite-plugin-virtual-html-issue.git

From repo root run this (vite-plugin-virtual-html is @1.1.5):

yarn workspace app vite

http://localhost:8080 -> shows index
http://localhost:8080/logout -> shows logout

yarn workspace app add vite-plugin-virtual-html@1.1.6
yarn workspace app vite

http://localhost:8080 -> shows index
http://localhost:8080/logout -> 404

fixed

commented

@windsonR Yes, working again with 1.1.7. Thank you for fixing it quickly!