solid-start
solid-start copied to clipboard
fix unstable islands on windows
I replaced the backslashes in the windows path with forward slashes
I have to ask.. is doing path conversions like this our best option?
There's no native path conversion in node, unfortunately.
I don't know if that's how it's supposed to be done, but it seems to work on both Windows and Linux
I implemented a similar fix in the movies branch. Using the vite normalizePath
function.
https://github.com/solidjs/solid-start/blob/movies/packages/start/islands/vite-plugin.js
I don't know if that's how it's supposed to be done
Going by the node documentation I'd assume something like this:
// file: index.mjs
import { parse, posix, sep} from 'node:path';
const toPosix = (original) =>
original.split(sep).join(posix.sep);
const full = process.argv[1];
const { root, dir } = parse(full);
const noRoot = dir.slice(root.length);
console.log(toPosix(full));
console.log(toPosix(dir));
console.log(toPosix(noRoot));
That said Vite's regex replace seems to be the fastest on V8.