Angular5中遇./node_modules/ng4-files/index.ts不在编译输出的错误
Fixing
./node_modules/ng4-files/index.ts is not part of the compilation output Error in Angular 5 我前几天刚上手Angular 5开发,最近碰到了一个棘手的编译错误:
./node_modules/ng4-files/index.ts is not part of the compilation output. Please check the other error messages for details.
这个问题的核心是ng4-files包里的index.ts文件没被纳入Angular的编译流程,我翻遍项目配置也没找到专门编译这个文件的脚本。
经过多次测试验证,我找到了可行的解决方案:把node_modules/ng4-files/index.ts路径添加到项目根目录tsconfig.json的"include"区块中,让Angular编译器明确将这个文件纳入编译范围。
修改后的tsconfig.json示例如下:
{ "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/ng4-files/index.ts" ] }
亲测这个方法能完美解决问题,希望能帮到遇到同样困扰的小伙伴!
内容的提问来源于stack exchange,提问作者Anil Kumar
相关产品推荐
相关产品推荐

