vikejs / vike

🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.
https://vike.dev
MIT License
4.39k stars 353 forks source link

Bizarre bug seemingly relating to client-side-routing #1888

Closed jaydevelopsstuff closed 1 month ago

jaydevelopsstuff commented 2 months ago

Description

Been running into this and despite some fiddling around I haven't been able to resolve it.

6:00:16 PM [vike@0.4.196][Bug] You stumbled upon a Vike bug. Go to https://github.com/vikejs/vike/issues/new and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).
    at isVirtualFileId (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vike/dist/esm/utils/virtual-files.js:13:5)
    at ResolveIdContext.resolveId (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vike/dist/esm/node/plugin/plugins/importUserCode/index.js:33:17)
    at PluginContainer.resolveId (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:48952:17)
    at ResolveIdContext.resolve (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:49112:15)
    at viteResolve (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite-tsconfig-paths/src/index.ts:162:12)
    at file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite-tsconfig-paths/src/index.ts:327:16
    at ResolveIdContext.resolveId (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite-tsconfig-paths/src/index.ts:172:43)
    at PluginContainer.resolveId (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:48951:22)
    at TransformPluginContext.resolve (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:49112:15)
    at normalizeUrl (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:63976:26)
    at file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:64115:39
    at async Promise.all (index 1)
    at TransformPluginContext.transform (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:64042:7)
    at PluginContainer.transform (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:49033:18)
    at loadAndTransform (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:51866:27)
    at viteTransformMiddleware (file:///Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vite/dist/node/chunks/dep-DG6Lorbi.js:61823:24)

image image

Client-side routing no longer works and it seems a full refresh occurs after every navigation. I'm using vike-solid by the way.

brillout commented 2 months ago

That's quite unexpected indeed. Modify the line 13 of /Users/.../Documents/Coding/Web/cosmil-website-solid/node_modules/vike/dist/esm/utils/virtual-files.js and report back.

function isVirtualFileId(id) {
    if (id.startsWith(idBase))
        return true;
    if (id.startsWith(tag + idBase))
        return true;
-   assert(!id.includes(idBase));
+   assert(!id.includes(idBase), { id, idBase });
    return false;
}
brillout commented 1 month ago

Let's reopen once we get more information on this.