refactor: remove @theme aliases

pull/1136/head
Divyansh Singh 3 years ago
parent ba9aa72d9b
commit 952de911a6

@ -7,7 +7,7 @@ import {
onMounted, onMounted,
watch watch
} from 'vue' } from 'vue'
import Theme from '/@theme/index' import Theme from '../theme-default'
import { inBrowser, pathToFile } from './utils' import { inBrowser, pathToFile } from './utils'
import { Router, RouterSymbol, createRouter } from './router' import { Router, RouterSymbol, createRouter } from './router'
import { siteDataRef, useData } from './data' import { siteDataRef, useData } from './data'

@ -11,7 +11,6 @@
"lib": ["ESNext", "DOM"], "lib": ["ESNext", "DOM"],
"types": ["vite/client"], "types": ["vite/client"],
"paths": { "paths": {
"/@theme/*": ["theme-default/*"],
"vitepress": ["index.ts"], "vitepress": ["index.ts"],
"vitepress/theme": ["../../types/default-theme.d"] "vitepress/theme": ["../../types/default-theme.d"]
} }

@ -16,17 +16,11 @@ export const SITE_DATA_ID = '@siteData'
export const SITE_DATA_REQUEST_PATH = '/' + SITE_DATA_ID export const SITE_DATA_REQUEST_PATH = '/' + SITE_DATA_ID
export function resolveAliases(root: string, themeDir: string): AliasOptions { export function resolveAliases(root: string, themeDir: string): AliasOptions {
const paths: Record<string, string> = {
'/@theme': themeDir,
'@theme': themeDir,
[SITE_DATA_ID]: SITE_DATA_REQUEST_PATH
}
const aliases: Alias[] = [ const aliases: Alias[] = [
...Object.keys(paths).map((p) => ({ {
find: p, find: SITE_DATA_ID,
replacement: paths[p] replacement: SITE_DATA_REQUEST_PATH
})), },
{ {
find: /^vitepress$/, find: /^vitepress$/,
replacement: join(DIST_CLIENT_PATH, '/index') replacement: join(DIST_CLIENT_PATH, '/index')

Loading…
Cancel
Save