Typescript:您可能需要一个额外的加载器来处理这些加载器的结果

Typescript: You may need an additional loader to handle the result of these loaders

提问人:Abhisar Tripathi 提问时间:11/7/2023 更新时间:11/7/2023 访问量:80

问:

我尝试在我的代码库中集成一个名为 -> 的库。 但是当我尝试使用该库时出现此错误:YAML

ERROR in ./node_modules/yaml/browser/dist/nodes/YAMLSeq.js 93:14
Module parse failed: Unexpected token (93:14)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     value: function toJSON(_, ctx) {
|       var seq = [];
>       if (ctx?.onCreate) ctx.onCreate(seq);
|       var i = 0;
|       var _iterator = _createForOfIteratorHelper(this.items),

这是我的文件:tsconfig.js

{
"compilerOptions": {
  "outDir": "./dist/",
  "baseUrl": "src",
  "paths": {
    "common/*": ["common/*"],
    "modules/*": ["modules/*"],
    "store/*": ["store/*"],
    "fac/*": ["fac/*"],
    "i18n/*": ["i18n/*"],
    "utils/*": ["utils/*"],
    "data/*": ["data/*"]
  },
  "typeRoots": ["node_modules/@types", "typings"],
  "sourceMap": true,
  "module": "es6",
  "target": "es5",
  "experimentalDecorators": true,
  "jsx": "react",
  "moduleResolution": "node",
  "allowSyntheticDefaultImports": true,
  "noStrictGenericChecks": true,
  "lib": ["es5", "es2015", "dom", "scripthost"],
  "keyofStringsOnly": true,
  "noUnusedLocals": true,
  "noUnusedParameters": true
},
"include": [
  "./src/**/*.ts",
  "./src/**/*.tsx", "src/utils/Link/index.tsx"
]
}

我觉得我的有一些错误compilerOptions -> lib

我无法理解我在这里需要做什么? 任何提示都会有所帮助。

打字稿 webpack ecmascript-6 babeljs

评论


答: 暂无答案