6
Vite 添加 alias
source link: https://www.ixiqin.com/2021/11/vite-add-alias/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Vite 添加 alias
如果你希望简化你的 import 引用,可以通过在 Vite 中配置 alias ,来简化你的 import 引用。
只需要定义 reslove.alias 属性即可配置。
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@c': path.resolve(__dirname, './src/components'),
},
}
})
发布日期:2021年11月7日
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK