Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持 resolve alias #149

Closed
nighca opened this issue Oct 9, 2021 · 1 comment · Fixed by #158
Closed

支持 resolve alias #149

nighca opened this issue Oct 9, 2021 · 1 comment · Fixed by #158
Labels

Comments

@nighca
Copy link
Collaborator

nighca commented Oct 9, 2021

这里是对 #33 中 alias 部分的细化

涉及的能力类似 webpack 的 resolve alias

在 webpack 的 resolve 逻辑上,目前我们约定对于 srcDir 下的内容 <srcDir>/foo,均可以通过 foo 来引入;这导致

  1. Typescript 项目总是需要再额外在 tsconfig 中配置 baseUrl: <srcDir> 以保持 tsc 与 webpack 行为的一致
  2. 对于一般的项目来说,这样可能不是最合理的(考虑 srcDir 下的目录/文件名的不确定性,很容易跟 node_modules 中的包名冲突),而像 @/foo 的方式可能是更合理的

需要考虑下我们怎么去支持更合理的行为,可能的姿势是:

  1. 对于 Typescript 项目,builder 自己去读取 tsconfig 中对于 paths 的配置,并添加对应的 resolve alias
  2. 提供通过 build config 对 resolve alias 进行配置的能力

此外这个也会与 #43 有一定的相关性

@nighca
Copy link
Collaborator Author

nighca commented Dec 24, 2021

已在 #158 中支持,对于上面提到的

  1. 对于 Typescript 项目,builder 自己去读取 tsconfig 中对于 paths 的配置,并添加对应的 resolve alias

后续在 #43 中跟进

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant