-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: handle rapid mode for tnpm and cnpm detection (#11710)
* refactor(bundler-webpack): fs cache support tnpm rapid mode * refactor(utils): handle rapid mode for tnpm/cnpm detection
- Loading branch information
1 parent
8e4db78
commit 0b2daeb
Showing
2 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,8 +243,10 @@ export async function getConfig(opts: IOpts): Promise<Configuration> { | |
// 使用 immutablePaths 避免 node_modules 的内容被写入缓存 | ||
// tnpm 安装的依赖路径中同时包含包名和版本号,满足 immutablePaths 使用的条件 | ||
// 同时配置 managedPaths 将 tnpm 的软连接结构标记为可信,避免执行快照序列化时 OOM | ||
// ref: smallfish | ||
if (/*isTnpm*/ require('@umijs/utils/package').__npminstall_done) { | ||
// 此处通过软链的目标文件夹名称来判断 node_modules 是否为 tnpm 的 npminstall 模式 | ||
// 因为 rapid 模式下 package.json 中没有 __npminstall_done 的标记 | ||
// ex. node_modules/_@[email protected]@@umijs/utils/package.json | ||
if (require.resolve('@umijs/utils/package').includes('_@umijs_utils@')) { | ||
const nodeModulesPath = | ||
opts.cache.absNodeModulesPath || | ||
join(opts.rootDir || opts.cwd, 'node_modules'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters