最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

alias - What does Nx plugin nxViteTsPaths() do exactly? Especially in addition to vite's tsconfigPaths() plugin - Stack

programmeradmin3浏览0评论

I have a NX/vite based monorepo and want to use path alias to avoid long relative imports.

I configured my tsconfig.json for each packages and then installed the vite plugin tsconfigPaths() for reading paths from tsconfig.json.

{
  "compilerOptions": {
    ... 
    "baseUrl": "./src",
    "paths": {
      "@components/*": ["components/*"],
      "@constants/*": ["constants/*"],
      "@pages/*": ["pages/*"]
    }
  },
  ...
}

Screenshot on the configuraton of nxViteTsPaths and tsconfigPaths plugins

On Nx's official document for configuring vite /recipes/vite/configure-vite, they required to use nxViteTsPaths() plugin, but I failed to find enough doc or source code from /plugin-registry.

Could anyone share insights on what additional functionality this nxViteTsPaths() does?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论