From 952de911a6d8c1165d015aeb55ae53a75c1baa7a Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 4 Jul 2022 12:40:55 +0530 Subject: [PATCH] refactor: remove @theme aliases --- src/client/app/index.ts | 2 +- src/client/tsconfig.json | 1 - src/node/alias.ts | 14 ++++---------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/client/app/index.ts b/src/client/app/index.ts index bfd2a0da..2975be64 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/index' +import Theme from '../theme-default' 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 9208c9f6..11fae953 100644 --- a/src/client/tsconfig.json +++ b/src/client/tsconfig.json @@ -11,7 +11,6 @@ "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 57b69a97..3b6c0f10 100644 --- a/src/node/alias.ts +++ b/src/node/alias.ts @@ -16,17 +16,11 @@ 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[] = [ - ...Object.keys(paths).map((p) => ({ - find: p, - replacement: paths[p] - })), + { + find: SITE_DATA_ID, + replacement: SITE_DATA_REQUEST_PATH + }, { find: /^vitepress$/, replacement: join(DIST_CLIENT_PATH, '/index')