feat: Add @ alias to ./src

This commit is contained in:
frostime 2023-06-06 15:44:42 +08:00
parent 14479d3d14
commit 6b903d5a14
4 changed files with 17 additions and 6 deletions

View file

@ -1,8 +1,8 @@
<script lang="ts"> <script lang="ts">
import { onDestroy, onMount } from "svelte"; import { onDestroy, onMount } from "svelte";
import { version } from "./api"; import { version } from "@/api";
import { showMessage } from "siyuan"; import { showMessage } from "siyuan";
import Typo from "./libs/b3-typography.svelte"; import Typo from "@/libs/b3-typography.svelte";
export let name: string; export let name: string;
export let i18n: any; export let i18n: any;

View file

@ -10,10 +10,10 @@ import {
getBackend, getBackend,
IModel IModel
} from "siyuan"; } from "siyuan";
import "./index.scss"; import "@/index.scss";
import HelloExample from "./hello.svelte"; import HelloExample from "@/hello.svelte";
import SettingPannel from "./libs/setting-panel.svelte"; import SettingPannel from "@/libs/setting-panel.svelte";
const STORAGE_NAME = "menu-config"; const STORAGE_NAME = "menu-config";
const TAB_TYPE = "custom_tab"; const TAB_TYPE = "custom_tab";

View file

@ -35,7 +35,12 @@
"node", "node",
"vite/client", "vite/client",
"svelte" "svelte"
] ],
"baseUrl": "./src",
"paths": {
"@/*": ["*"],
"@/libs/*": ["libs/*"],
}
}, },
"include": [ "include": [
"tools/**/*.ts", "tools/**/*.ts",

View file

@ -16,6 +16,12 @@ console.log("isWatch=>", isWatch)
console.log("distDir=>", distDir) console.log("distDir=>", distDir)
export default defineConfig({ export default defineConfig({
resolve: {
alias: {
"@": resolve(__dirname, "src"),
}
},
plugins: [ plugins: [
svelte(), svelte(),