我正在尝试编译我的 Angular 应用程序,但遇到错误。 似乎是编译器无法识别 index.ts 文件。我不确定为什么。
错误如下:
ERROR in ./node_modules/datatable/index.ts
Module build failed: Error: node_modules\datatable\index.ts is not part of the compilation output. Please check the other error messages for details.
at AngularCompilerPlugin.getCompiledFile (node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
at plugin.done.then (node_modules\@ngtools\webpack\src\loader.js:467:39)
at process._tickCallback (internal/process/next_tick.js:103:7)
@ ./src/main/ui/app/app.module.ts 13:0-59
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./node_modules/typeahead/index.ts
Module build failed: Error: node_modules\typeahead\index.ts is not part of the compilation output. Please check the other error messages for details.
at AngularCompilerPlugin.getCompiledFile (\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
at plugin.done.then (node_modules\@ngtools\webpack\src\loader.js:467:39)
at process._tickCallback (internal/process/next_tick.js:103:7)
@ ./src/main/ui/app/app.module.ts 12:0-59
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
有没有人对如何解决这个问题有任何建议? 谢谢。
最佳答案
angular-bootstrap-md\index.ts
我遇到了类似的问题how I could fix it:
Just put the index.ts file to the tsconfig.jsons include block , see below:
{ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2017", "dom" ] }, "include": [ "src/**/*", "node_modules/angular-bootstrap-md/index.ts" ] }
关于angular - index.ts 不是编译输出的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47184714/