路径别名
首先在 backend/server/tsconfig.json 中添加
json
"paths": {
"#/*": [
"./src/*.ts"
]
},让 TypeScript / IDE 知道路在何方。
其次在 packgae.json 中添加
json
"imports": {
"#/*": {
"types": "./src/*.ts",
"development": "./src/*.ts",
"default": "./dist/*.js"
}
}让 nodejs 知道路在何方
最后在 scripts 主动告诉tsx走那条路
json
"scripts": {
"dev": "tsx watch --conditions=development src/index.ts",
},最终完成了 hono 的路径别名功能?
