diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b249002..187e2b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,8 +14,12 @@ permissions: jobs: tests: - name: Build and test - runs-on: ubuntu-latest + name: Build and test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4 diff --git a/src/vite/index.ts b/src/vite/index.ts index 4279b50..3bc19fa 100644 --- a/src/vite/index.ts +++ b/src/vite/index.ts @@ -319,12 +319,12 @@ export function fileRoutes(options: FileRoutesOptions = {}): PluginOption[] { // plus the `src` lazy refs already expose. if (!codeSplitting) { return { - src: relative(root, buildId), + src: normalizePath(relative(root, buildId)), require: `_$() => (${js.addNamespaceImport(buildId)})$_` }; } return { - src: relative(root, buildId), + src: normalizePath(relative(root, buildId)), build: isBuild ? `_$() => import('${buildId}')$_` : undefined, import: `_$() => import('${buildId}')$_` }; diff --git a/test/vite.spec.ts b/test/vite.spec.ts index d0af478..302d012 100644 --- a/test/vite.spec.ts +++ b/test/vite.spec.ts @@ -85,6 +85,21 @@ describe("fileRoutes vite plugin", () => { expect(code.match(/pick=default&pick=\$css&lang\.tsx'\)/g)?.length).toBe(2); }); + it("serializes lazy-ref src values with forward slashes", async () => { + const directory = createRouteTree({ + "index.tsx": "export default () =>