From 5c2854f1ab8d2c981202e2086fb1ee310993fc16 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 14 Jul 2022 22:23:25 +0530 Subject: [PATCH] revert: 952de911a6d8c1165d015aeb55ae53a75c1baa7a --- src/client/app/index.ts | 2 +- src/client/tsconfig.json | 1 + src/node/alias.ts | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/client/app/index.ts b/src/client/app/index.ts index 2975be64b67f..bfd2a0da35bb 100644 --- a/src/client/app/index.ts +++ b/src/client/app/index.ts @@ -7,7 +7,7 @@ import { onMounted, watch } from 'vue' -import Theme from '../theme-default' +import Theme from '/@theme/index' import { inBrowser, pathToFile } from './utils' import { Router, RouterSymbol, createRouter } from './router' import { siteDataRef, useData } from './data' diff --git a/src/client/tsconfig.json b/src/client/tsconfig.json index 11fae953eeb5..9208c9f6ccd4 100644 --- a/src/client/tsconfig.json +++ b/src/client/tsconfig.json @@ -11,6 +11,7 @@ "lib": ["ESNext", "DOM"], "types": ["vite/client"], "paths": { + "/@theme/*": ["theme-default/*"], "vitepress": ["index.ts"], "vitepress/theme": ["../../types/default-theme.d"] } diff --git a/src/node/alias.ts b/src/node/alias.ts index 3b6c0f10bc9d..57b69a97c5e7 100644 --- a/src/node/alias.ts +++ b/src/node/alias.ts @@ -16,11 +16,17 @@ export const SITE_DATA_ID = '@siteData' export const SITE_DATA_REQUEST_PATH = '/' + SITE_DATA_ID export function resolveAliases(root: string, themeDir: string): AliasOptions { + const paths: Record = { + '/@theme': themeDir, + '@theme': themeDir, + [SITE_DATA_ID]: SITE_DATA_REQUEST_PATH + } + const aliases: Alias[] = [ - { - find: SITE_DATA_ID, - replacement: SITE_DATA_REQUEST_PATH - }, + ...Object.keys(paths).map((p) => ({ + find: p, + replacement: paths[p] + })), { find: /^vitepress$/, replacement: join(DIST_CLIENT_PATH, '/index')