我将 Angular 应用程序从 v8 升级到 v9。该项目使用 Angular 8 和 moment.js 导入自定义 UI 库。
当我构建它时:
WARNING in Entry point '@myLib/catalogue' contains deep imports into
'/Users/xyz/Projects/forms-frontend/node_modules/moment/locale/de'.
This is probably not a problem, but may cause the compilation of entry points to be out of order.
在
@myLib/catalogue.js
库文件(在 node_modules 文件夹内),moment.js DE 语言环境导入如下:import 'moment/locale/de';
ERROR in Failed to compile entry-point @myLib/catalogue (es2015 as esm2015) due to compilation errors:
node_modules/@myLib/catalogue/fesm2015/catalogue.js:213:26 - error NG1010: Value at position 2 in the NgModule.imports of FormInputModule is not a reference: [object Object]
213 imports: [
~
214 CommonModule,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
219 TranslateModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220 ],
~~~~~~~~~~~~~~~~~
警告的文本似乎准确地解释了编译错误,其中位置(在本例中为 2)超出了导入数组的范围。
我看过不同的文章/github issues关于深层链接,但没有有效的解决方案。
最佳答案
您可能使用过 npm i 并且编辑器可能无法正确生成构建。尝试重新启动编辑器。重新启动对我有用。我正在使用 VSCode
关于Angular 9 : Value at position X in the NgModule. 导入不是引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60726180/