vite中alias別名配置


vire.config.js

 1 // resolve.alias
 2 import {
 3  defineConfig
 4 } from 'vite'
 5 import path from "path";
 6 import vue from '@vitejs/plugin-vue'
 7 
 8 
 9 // https://vitejs.dev/config/
10 export default defineConfig({
11  resolve: {
12    alias: {
13      "@": path.resolve(__dirname, "src"),
14      "components": path.resolve(__dirname, "src/components"),
15      "styles": path.resolve(__dirname, "src/styles"),
16      "plugins": path.resolve(__dirname, "src/plugins"),
17      "views": path.resolve(__dirname, "src/views"),
18      "layouts": path.resolve(__dirname, "src/layouts"),
19      "utils": path.resolve(__dirname, "src/utils"),
20      "apis": path.resolve(__dirname, "src/apis"),
21      "dirs": path.resolve(__dirname, "src/directives"),
22    },
23  },
24  plugins: [vue()],
25 })

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM