![](/img/trans.png)
[英]How can i solve "Error: \src\main.ts is missing from the TypeScript compilation."
[英]Webpack:is missing from the TypeScript compilation. …at AngularCompilerPlugin.getCompiledFile
我在 web 應用程序中使用 angular 10.1.0-next.4
"@ngtools/webpack": "^10.0.0",
"webpack": "^4.43.0",
並在構建時出錯。
PS D:\app2020\testing\local\angular10\sampleangular10app\myangular10app> ng run myangular10app:build-worker
Hash: 8132eb4a13b2ee0de491
Version: webpack 4.44.1
Time: 134ms
Built at: 08/12/2020 12:01:42 AM
Asset Size Chunks Chunk Names
./src/appResourceFiles/workers/httpWebWorker.js 1.66 KiB 0 ./src/appResourceFiles/workers/httpWebWorker
Entrypoint ./src/appResourceFiles/workers/httpWebWorker = ./src/appResourceFiles/workers/httpWebWorker.js
[0] multi ./src/webWorker/main.worker.ts 28 bytes {0} [built]
[1] ./src/webWorker/main.worker.ts 734 bytes {0} [built] [failed] [1 error]
ERROR in ./src/webWorker/main.worker.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: D:\app2020\testing\local\angular10\sampleangular10app\myangular10app\src\webWorker\main.worker.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:\app2020\testing\local\angular10\sampleangular10app\myangular10app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:935:23)
at D:\app2020\testing\local\angular10\sampleangular10app\myangular10app\node_modules\@ngtools\webpack\src\loader.js:42:31
at processTicksAndRejections (internal/process/task_queues.js:97:5)
@ multi ./src/webWorker/main.worker.ts ./src/appResourceFiles/workers/httpWebWorker[0]
PS D:\app2020\testing\local\angular10\sampleangular10app\myangular10app>
這是github示例應用程序。 我需要更新或缺少任何配置或版本嗎?
您需要將項目目錄包含在內,否則您的代碼將不會被編譯。 在 tsconfig.app.json 更改:
"files": [
...,
"node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxbargauge.ts"
],
或者
"include": [
...,
"node_modules/jqwidgets-scripts/jqwidgets-ts/**/*.ts"
],
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.