【问题标题】:angular production build fails in Nx workspace due relative path由于相对路径,角度生产构建在 Nx 工作空间中失败
【发布时间】:2021-07-16 16:36:05
【问题描述】:

当我为我们的 nx 工作区 (v11.x) 中的一个 angular (v11.x) 库触发生产构建时,我收到以下错误:

nx run i18n-components:build:production 
Building Angular Package

------------------------------------------------------------------------------
Building entry point '@smallstack/i18n-components'
------------------------------------------------------------------------------
√ Compiling TypeScript sources through NGC
× Bundling to FESM2015
ERROR: Could not resolve '../../../../../../dist/libs/axios-api-client/src/index' from dist\libs\components\i18n-components\esm2015\lib\stores\locale.store.js
Could not resolve '../../../../../../dist/libs/axios-api-client/src/index' from dist\libs\components\i18n-components\esm2015\lib\stores\locale.store.js

———————————————————————————————————————————————

>  NX   ERROR  Running target "build" failed

查看locale.store.js 中的输出,似乎不是通过 tsconfig->paths 使用包名,而是尝试通过相对路径查找文件。

【问题讨论】:

    标签: angular build production nrwl-nx


    【解决方案1】:

    我发现了问题...如果您的服务是 @Injectable({ providedIn: "root" })@Injectable({ providedIn: "platform" }) 需要的服务不是,您会收到该错误。

    我猜,根服务应该只依赖于其他根服务?

    【讨论】:

      猜你喜欢
      • 2022-11-12
      • 2020-09-24
      • 2019-05-01
      • 2022-01-25
      • 2023-03-29
      • 2019-07-02
      • 1970-01-01
      • 2019-08-09
      • 2020-09-29
      相关资源
      最近更新 更多