javascript - Webpack:TypeScript 编译中缺少。...在 AngularCompilerPlugin.getCompiledFile
问题描述
我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示例应用程序。我需要更新或缺少任何配置或版本吗?
解决方案
您需要将项目目录包含在内,否则您的代码将不会被编译。在 tsconfig.app.json 更改:
"files": [
...,
"node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxbargauge.ts"
],
或者
"include": [
...,
"node_modules/jqwidgets-scripts/jqwidgets-ts/**/*.ts"
],
推荐阅读
- r - 使用 r 将字符串中的匹配单词替换为单词
- django - 即使在视图设置为@xframe_options_exempt 后,Django iframe 加载也被 xframe 选项拒绝
- jenkins - 我如何判断 Jenkins checkout 是否拉了任何东西?
- r - 来自用户加载数据的闪亮图
- python-3.x - 重新训练 Inception V3 模型以进行机器学习
- c# - 从 Log4Net 中删除堆栈跟踪的顶层
- r - 删除字符串中位置标识的某个事件之前的所有内容
- javascript - Typescript 在我自己本地创建的 node_modules 中找不到模块
- sql - Liquibase 无法为 hsql 导入更改集
- c# - 关于使用 selenium c# 的会话超时