0

10.1.0-next.4在 Web 应用程序中使用 Angular

   "@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示例应用程序。我需要更新或缺少任何配置或版本吗?

4

1 回答 1

0

您需要将项目目录包含在内,否则您的代码将不会被编译。在 tsconfig.app.json 更改:

"files": [
    ...,
    "node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxbargauge.ts"
  ],

或者

"include": [
    ...,
    "node_modules/jqwidgets-scripts/jqwidgets-ts/**/*.ts"
  ],
于 2020-08-11T21:26:45.910 回答