Angular 9 构建错误自定义命名导出

Angular 9 build error Custom named exports

我有一个项目 Angular 9.0

我用这个命令创建新库:

ng g library @scope/xxx --skip-install.

当我执行命令 ng b @scope/xxx 进行构建时,我遇到了这个错误:

[error] Error: Custom named exports were specified for E:\...\dist\scope\xxx\fesm5\scope-xxx.js but it does not appear to be a CommonJS module
    

如何解决这个错误?

这很奇怪但是这个解决方案很有用。

我将 "module": "es2015" 添加到 tsconfig.lib.json 文件库的 compilerOptions 部分。

错误已修复。