admin管理员组文章数量:1434900
I'm using vite in my monorepo and I want to prohibit direct imports (without passing through the package name).
I have this structure:
root
|---packages
| |-------front
| |-------utils
|
|---package.json
I want to avoid that someone does this
//in front/main.ts
import { something } from "../utils/lib.ts
They need to do this instead
import { something } from "@repo/utils"
I am using vite. I tried the fs.allowed option, but it does not prevent me from doing this wrong import.
//it still allows for every import style
fs:{
allowed: ["./src"],
}
本文标签: viteHow to forbid direct imports from other packages in a Typescript monorepoStack Overflow
版权声明:本文标题:vite - How to forbid direct imports from other packages in a Typescript monorepo? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745644957a2668079.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论