Closed KMilhan closed 3 years ago
Hi, thanks for the kind words, and for bringing this to my attention.
After looking into this a little, I'm pretty certain that most of the passing tests in routes.spec.ts
are actually false positives on Windows because we are using paths that we'd never see in practice e.g. src/pages/index.vue
.
To boost my confidence that we are supporting Windows correctly I'm going to update the tests to be platform agnostic, which should hopefully lead to a fix in the process 😀
Part of the issue is tied to fast-glob/micromatch library. Their pattern matching doesn't work with path.join() on Windows, so the buildRoutes method was getting an empty array of files. https://github.com/micromatch/micromatch#backslashes
FWIW, I was able to build successfully on Windows using the following.
async function generateRoutesCode(options) {
const {root, pagesDir, exclude, extensions, extendRoute} = options;
//const dir = _path2.default.join(root, pagesDir);
const joinedPath = _path2.default.join(root, pagesDir);
const dir = joinedPath.replace(/\\/g, '/');
const files = await resolve({dir, extensions, exclude});
const routes = buildRoutes({files, dir, extensions, root, extendRoute});
return stringifyRoutes(routes, options);
}
I got the same problem [Vue Router warn]: No match found for location with path "/" After I ugrade to vite 2 and vite-plugin-voie: 0.7.1
Thanks @greenskybluephish for your input, I've come up with a fix based on your solution. I've tested this on Windows and it appears to be working just fine, going to test it on WSL and then hopefully I can release a fix 😀
A fix has been released in v0.7.2, please let me know if you see any more issues
Problems are totally gone. Appreciate it a lot @brattonross .
Dear contributors,
Thanks for this awesome project! :)
After the recent update, I discovered voie is failing to build a route in my Windows machine. Quick jest run result is
I believe the problem occurs after the release 0.5 and using
path.sep
insideroutes.ts
and having actual set of Vue files as a test resource would be a remedy.