如何实现"monorepo yarn 不生成node_modules"

整个流程

步骤 描述
1 创建一个新的monorepo项目
2 配置monorepo项目以使用yarn workspaces
3 禁止yarn生成各个package的node_modules目录

每一步的操作

步骤一:创建一个新的monorepo项目

mkdir my-monorepo
cd my-monorepo

步骤二:配置monorepo项目以使用yarn workspaces

yarn config set workspaces-experimental true

步骤三:禁止yarn生成各个package的node_modules目录

yarn config set nodeLinker node-modules

序列图

sequenceDiagram
    小白->>你: 请求如何实现"monorepo yarn 不生成node_modules"
    你->>小白: 开始指导
    小白->>你: 创建新的monorepo项目
    你->>小白: 配置项目使用yarn workspaces
    你->>小白: 禁止yarn生成node_modules

旅行图

journey
    title 如何实现"monorepo yarn 不生成node_modules"
    section 创建项目
        小白-> 创建新的monorepo项目: mkdir my-monorepo
        小白-> 创建新的monorepo项目: cd my-monorepo
    section 配置项目
        小白-> 配置项目使用yarn workspaces: yarn config set workspaces-experimental true
    section 禁止生成node_modules
        小白-> 禁止yarn生成node_modules: yarn config set nodeLinker node-modules

通过以上步骤,你就可以实现"monorepo yarn 不生成node_modules"了。希望对你有所帮助!如果还有其他问题,欢迎随时向我提问。