升级到 Angular 5 和 Cli 1.5 后,ng serve
出现错误:
ERROR in ./node_modules/@stomp/ng2-stompjs/index.ts
Module build failed: Error: ...\project\node_modules\@stomp\ng2-stompjs\index.ts is not part of the compilation output. Please check the other error messages for details.
at AngularCompilerPlugin.getCompiledFile (...\project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
at plugin.done.then (...\project\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
@ ./src/app/app.module.ts 27:0-63
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
我试图添加include
到我的tsconfig.app.json
,所以它看起来像这样:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"include": [
"../node_modules/@stomp/**/*.ts"
],
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
我尝试重新运行ng serve
我得到另一个错误:
ERROR in ./src/main.ts
Module build failed: Error: ...project\chatAngular4\src\main.ts is not part of the compilation output. Please check the other error messages for details.
at AngularCompilerPlugin.getCompiledFile (...project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
at plugin.done.then (...project\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./src/polyfills.ts
Module build failed: Error: C:\Users\MEP2\Desktop\chatAngular4\src\polyfills.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (...project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:624:23)
at plugin.done.then (...project\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
@ multi ./src/polyfills.ts
这看起来需要某种通用的解决方法。有任何想法吗?
更新
将所有软件包更新到最新版本后,问题消失了