我以前一直在使用Angular 8和Material UI (在10或11发布之前),我有一个导入所有Material UI组件的文件,但是当我尝试在Angular 11中做同样的事情时,我得到了错误。如果我单独导入,它会编译,但如果我作为一个文件导入(它导入所有组件),我得到的错误如下-
Error: ./src/app/material.module.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: D:\Angular app\form\src\app\material.module.ts is missing from the TypeScript compilation.
Please make sure it is
in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (D:\Angular
app\form\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:951:23)
at D:\Angular app\form\node_modules\@ngtools\webpack\src\loader.js:43:31
at processTicksAndRejections (internal/process/task_queues.js:89:5)
~~~~~~~~~~~~~~~~~~~作为导入{MaterialModule}包含在app.module.ts中的'./material.module‘中。
发布于 2020-12-03 01:07:47
我已经设法修复了它,与以前的版本不同,组件需要在material.module.ts文件中单独调用。
https://stackoverflow.com/questions/64990766
复制相似问题