【问题标题】:NX workspace angular - generate component in libraryNX 工作空间角度 - 在库中生成组件
【发布时间】:2022-11-12 20:49:55
【问题描述】:

我不知道如何在 nx 工作区中生成组件到库。这是我的图书馆结构。库位于文件夹中(例如 libs/features、libs/shared)。我想在库订单(库/功能/订单)中创建组件。

nx g @nrwl/angular:component orders-list --project orders

错误:

找不到 NgModule。使用 skip-import 选项跳过 NgModule 中的导入。

角度.json{ "version": 2, "projects": { "orders": "libs/features/orders" } }

如果模块在子文件夹中,如何将组件生成到库?

【问题讨论】:

    标签: angular nomachine-nx


    【解决方案1】:

    对项目使用features-orders

    nx g @nrwl/angular:library orders --directory=features 
    nx g @nrwl/angular:component orders-list --project=features-orders
    

    输出

    >  NX  Generating @nrwl/angular:library
    
    CREATE libs/features/orders/README.md
    CREATE libs/features/orders/tsconfig.lib.json
    CREATE libs/features/orders/tsconfig.spec.json
    CREATE libs/features/orders/src/index.ts
    CREATE libs/features/orders/src/lib/features-orders.module.ts
    CREATE libs/features/orders/project.json
    CREATE libs/features/orders/tsconfig.json
    UPDATE tsconfig.base.json
    CREATE libs/features/orders/jest.config.ts
    CREATE libs/features/orders/src/test-setup.ts
    CREATE libs/features/orders/.eslintrc.json
    
    >  NX  Generating @nrwl/angular:component
    
    CREATE libs/features/orders/src/lib/orders-list/orders-list.component.html
    CREATE libs/features/orders/src/lib/orders-list/orders-list.component.spec.ts
    CREATE libs/features/orders/src/lib/orders-list/orders-list.component.ts
    CREATE libs/features/orders/src/lib/orders-list/orders-list.component.scss
    UPDATE libs/features/orders/src/lib/features-orders.module.ts
    

    【讨论】:

      猜你喜欢
      • 2021-07-16
      • 2021-08-16
      • 2021-09-08
      • 2022-06-12
      • 1970-01-01
      • 2015-08-06
      • 1970-01-01
      • 2019-05-21
      • 2022-11-24
      相关资源
      最近更新 更多