Skip to content

Commit

Permalink
fix: 修复 npmClient 配置为 tnpm,但 tnpm mode 为 npm 时 layout 插件注入绝对路径 types 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzebang.hzb committed Mar 14, 2024
1 parent 2e0ae4d commit be7ec21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/plugins/src/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ export default (api: IApi) => {
});

api.onGenerateFiles(() => {
// tnpm 作为 npmClient 时,可能使用不同的安装模式
const realNpmClient =
(api.appData.npmClient === NpmClientEnum.tnpm && api.pkg.tnpm?.mode) ||
api.appData.npmClient;
// use absolute path to types references in `npm/yarn` will cause case problems.
// https://github.com/umijs/umi/discussions/10947
// https://github.com/umijs/umi/discussions/11570
const isFlattedDepsDir = [NpmClientEnum.npm, NpmClientEnum.yarn].includes(
api.appData.npmClient,
realNpmClient,
);
const PKG_TYPE_REFERENCE = `
/// <reference types="${
Expand Down

0 comments on commit be7ec21

Please sign in to comment.