From 8c9833ceba195885ef5704fb7a8a6702d15764c2 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 28 Feb 2023 17:38:21 +0800 Subject: [PATCH] test: fix dynamic routes test for build --- __tests__/e2e/__snapshots__/home.test.ts.snap | 2 +- __tests__/e2e/static-data/__snapshots__/data.test.ts.snap | 2 +- src/node/plugins/dynamicRoutesPlugin.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/e2e/__snapshots__/home.test.ts.snap b/__tests__/e2e/__snapshots__/home.test.ts.snap index ab5ce9c2..0c5972fc 100644 --- a/__tests__/e2e/__snapshots__/home.test.ts.snap +++ b/__tests__/e2e/__snapshots__/home.test.ts.snap @@ -1,4 +1,4 @@ -// Vitest Snapshot v1 +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`render correct content > main content 1`] = ` [ diff --git a/__tests__/e2e/static-data/__snapshots__/data.test.ts.snap b/__tests__/e2e/static-data/__snapshots__/data.test.ts.snap index 0e000a37..6f0bc57a 100644 --- a/__tests__/e2e/static-data/__snapshots__/data.test.ts.snap +++ b/__tests__/e2e/static-data/__snapshots__/data.test.ts.snap @@ -1,4 +1,4 @@ -// Vitest Snapshot v1 +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`static data file support in vite 3 > render correct content 1`] = ` [ diff --git a/src/node/plugins/dynamicRoutesPlugin.ts b/src/node/plugins/dynamicRoutesPlugin.ts index 9f21bd88..49e2b80a 100644 --- a/src/node/plugins/dynamicRoutesPlugin.ts +++ b/src/node/plugins/dynamicRoutesPlugin.ts @@ -57,7 +57,7 @@ export const dynamicRoutesPlugin = async ( resolveId(id) { if (!id.endsWith('.md')) return - const normalizedId = id.startsWith(config.root) + const normalizedId = id.startsWith(config.srcDir) ? id : normalizePath(path.resolve(config.srcDir, id.replace(/^\//, ''))) const matched = config.dynamicRoutes.routes.find(