从 npm 迁移到 Yarn 2 PnP:ts-loader 找不到 webpack

Migration from npm to Yarn 2 PnP: ts-loader doesn't find webpack

我正在做一个 NestJS 项目。

到目前为止,我一直在使用 npm。现在我想迁移到 Yarn 2 with Zero-Install an P'n'P.

但是,按照迁移说明进行操作后,我收到此错误:

~/IdeaProjects/service on feature/yarn-migration ⇡3 ❯ yarn explain peer-requirements p0b548                                                                                                                                                                                                           at 17:36:06
➤ YN0000: service@workspace:. doesn't provide webpack, breaking the following requirements:

➤ YN0000: ts-loader@npm:8.0.14 [0b662] → * ✘

我该如何解决这个问题?

如消息中所述,ts-loaderwebpack 具有对等依赖性。因此,您必须将 webpack 添加到您的依赖项中。