From 6382f68efd5a460b9ed4c794c1e4c007a2792021 Mon Sep 17 00:00:00 2001 From: Nex Zhu <4370605+NexZhu@users.noreply.github.com> Date: Mon, 27 Dec 2021 15:06:11 +0800 Subject: [PATCH] feat: add alias: `~` -> `src` --- .fes.js | 7 +++---- .fes.prod.js | 2 +- src/app.ts | 4 ++-- src/components/UserCenter.vue | 2 +- tsconfig.json | 4 +--- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.fes.js b/.fes.js index 4f0ca49..130cbf7 100644 --- a/.fes.js +++ b/.fes.js @@ -2,10 +2,9 @@ export default { publicPath: './', - // TODO: `alias` doesn't support TS for now - // alias: { - // '~': 'src', - // }, + alias: { + '~': '/src', + }, access: { roles: { admin: ['*'], diff --git a/.fes.prod.js b/.fes.prod.js index 2ac4624..eb159aa 100644 --- a/.fes.prod.js +++ b/.fes.prod.js @@ -1,5 +1,5 @@ // .fes.js 只负责管理编译时配置,只能使用plain Object export default { - publicPath: '', + publicPath: './', } diff --git a/src/app.ts b/src/app.ts index 0057b75..deff1d3 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,6 +1,6 @@ import { access } from '@fesjs/fes' -import PageLoading from '@/components/PageLoading.vue' -import UserCenter from '@/components/UserCenter.vue' +import PageLoading from '~/components/PageLoading.vue' +import UserCenter from '~/components/UserCenter.vue' export const beforeRender = { loading: PageLoading, diff --git a/src/components/UserCenter.vue b/src/components/UserCenter.vue index 9a4639b..c6c5086 100644 --- a/src/components/UserCenter.vue +++ b/src/components/UserCenter.vue @@ -4,7 +4,7 @@ diff --git a/tsconfig.json b/tsconfig.json index 2817a6c..88eed9a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "build/dist", "baseUrl": ".", "paths": { - // TODO: `.fes.js` > `alias` doesn't support TS for now - // "~/*": ["src/*"], - "@/*": ["src/*"], + "~/*": ["src/*"], "@@/*": ["src/.fes/*"] } },