webpack 调试失败,传递给“ts.resolveTypeReferenceDirective”的值不是字符串

puruo6ea  于 2022-11-13  发布在  Webpack
关注(0)|答案(2)|浏览(225)

我面临以下错误:

connect-43d439c034e475bba644.chunk.js:10 Uncaught Error: Module build failed (from ./node_modules/ts-loader/index.js):
Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.
    at Object.resolveTypeReferenceDirective (:3000/node_modules/typescript/lib/typescript.js:42537:18)
    at :3000/node_modules/ts-loader/dist/servicesHost.js:373:77
    at :3000/node_modules/ts-loader/dist/servicesHost.js:95:142
    at Array.map ()
    at Object.resolveTypeReferenceDirectives (:3000/node_modules/ts-loader/dist/servicesHost.js:95:125)
    at actualResolveTypeReferenceDirectiveNamesWorker (:3000/node_modules/typescript/lib/typescript.js:116674:163)
    at resolveTypeReferenceDirectiveNamesWorker (:3000/node_modules/typescript/lib/typescript.js:116974:26)
    at processTypeReferenceDirectives (:3000/node_modules/typescript/lib/typescript.js:118456:31)
    at findSourceFileWorker (:3000/node_modules/typescript/lib/typescript.js:118341:21)
    at findSourceFile (:3000/node_modules/typescript/lib/typescript.js:118196:26)
    at ./app/javascript/connect/index.ts (connect-43d439c034e475bba644.chunk.js:10:7)
    at __webpack_require__ (bootstrap:79:1)
    at ./app/javascript/packs/connect.js (connect.js:7:1)
    at __webpack_require__ (bootstrap:79:1)
    at 1 (log$:23:1)
    at __webpack_require__ (bootstrap:79:1)
    at checkDeferredModules (bootstrap:45:1)
    at Array.webpackJsonpCallback [as push] (bootstrap:32:1)
    at connect-43d439c034e475bba644.chunk.js:1:57

在这一点上,我已经尝试了几乎一切:
更新ts节点更新打字脚本更新ts加载程序
然而,似乎没有什么能解决这个问题。
在这一点上,我认为它不是严格的TS相关,但我不确定。以下是我的包的版本:

{
  "name": "Angular",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "",
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular-cool/inline-edit-field": "^1.0.3",
    "typescript": "^4.2",
    "uppy": "0.23.3",
    "zone.js": "^0.11.4"
  },
  "devDependencies": {
    "css-minimizer-webpack-plugin": "^3.1.1",
    "html-minimizer-webpack-plugin": "^3.3.0",
    "terser-webpack-plugin": "^5.2.4",
    "webpack-dev-server": "^3.10.3"
  },
  "resolutions": {
    "acorn": "^6.4.1",
    "minimist": "^1.2.3",
    "kind-of": "^6.0.3"
  },
  "engines": {
    "node": "14.x"
  }
}

如果有人能给予我一些建议,告诉我现在应该寻找什么,或者可能出了什么问题,我将不胜感激。提前感谢!

7lrncoxx

7lrncoxx1#

我刚刚找到了我的问题的解决方案,问题是与一些依赖关系,他们正在采取一个更大的版本,因为他们应该是,因为我正在使用'^ X.X.X'
我不得不设置"typescript": "4.3.5",而不是"typescript": "^4.2",等。

h43kikqp

h43kikqp2#

对我来说,我可以通过跑步来解决这个问题

npx ts-node ./test.ts

而不是

ts-node ./test.ts

相关问题