当前位置:网站首页>vite 中配置@表示访问src下的文件
vite 中配置@表示访问src下的文件
2022-07-15 12:02:00 【陌上烟雨寒】
vite 中配置@表示访问src下的文件
安装 插件
npm install --save-dev @types/node
vite.config.ts
import {
defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {
resolve } from 'path'
const pathResolve = (dir: string): any => {
return resolve(__dirname, '.', dir)
}
const alias: Record<string, string> = {
"@": pathResolve('src')
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias
}
})
tsconfig.json
compilerOptions 中添加
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
}

边栏推荐
- Mqtt--- subscribe and suback
- Meta宣布推出Make-A-Scene:可基于文字和草图控制AI图像生成
- 使用USBasp 通过ICSP模式给arduino UNO烧写程序
- 10分钟带你进入Swagger的世界,快来看一看吧
- IM即时通讯如何让企业远程办公更简单高效?
- 列表框(ListBox)
- XPath actual combat: climbing the learning ape land (Part 1)
- 51nod 1278 相离的圆
- Robotframework advanced (III) integrated Jenkins operation automation use case
- WebView loading URL prompt net:: error_ UNKNOWN_ URL_ SCHEME
猜你喜欢

Redis uses pipeline

One of MySQL artifact locks

基于eTS高效开发HarmonyOS课程类应用

HCIP笔记(1)

欧拉Talk | 开发者社区体验坦白局7月14日19:30约起

CCF 202012-1 期末预测之安全指数

解决中小型机房动环状态综合监控方案

Event preview | Apache Doris x Apache seatunnel joint meetup to start registration!

Analyze the meaning of "collaboration" in collaborative office, and how can digital office easily "solve the problem"?

The No.1 port and shipping AI enterprise in the world integrates Feitong, port and shipping AI products are mature, standardized and applied on a large scale, and advanced core technologies greatly im
随机推荐
第八十九期:对Pinia的简单思考
HCIP笔记(4)
什么是主动元数据?为什么Gartner预测它是元数据管理的新方向
第九十八期:Flutter学习(一)
Differences and relations among RDD, dataframe and dataset in spark
[the road of Exile - Chapter 1]
Introduction to esp8266 Lua (II)
GRE, mGRE experiment
ModuleNotFoundError: No module named ‘fake_useragent‘
pygame快速入门
Introduction to risk assessment
10分钟带你进入Swagger的世界,快来看一看吧
How can im make enterprise telecommuting simpler and more efficient?
Get started with pyGame
WebView loading URL prompt net:: error_ UNKNOWN_ URL_ SCHEME
"Open source star picking program" harbor high availability cluster design and deployment (practice + video), based on offline installation
HCIP笔记(2)
Vector
Hcip notes (1)
【云原生】基于Kubevela华为云的Terraform addon开发