typescript - Vue js - Du kan behöva en ytterligare loader för att hantera resultatet av dessa loaders


så jag har detta problem: Detta är min tsconfig:

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "noImplicitAny": false,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

Det här är mitt kodproblem: 1 - Filen behandlades med dessa laddare:

Module parse failed: Unexpected token (104:32)
File was processed with these loaders:
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/ts-loader/index.js
 * ./node_modules/eslint-loader/index.js
You may need an additional loader to handle the result of these loaders.
|             if (this.documents.length > 0) {
|                 this.documents.forEach((element) => {
>                     if (element?.children?.length > 0) {
|                         flattDocs.push(...element.children);
|                         delete element.children;

2 - Filen bearbetades med dessa laddare:

Module parse failed: Unexpected token (111:31)
File was processed with these loaders:
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/ts-loader/index.js
 * ./node_modules/eslint-loader/index.js
You may need an additional loader to handle the result of these loaders.
|     created() {
|         debugger;
>         if (this.$route.params?.id)
|             this.getAllProjectDocuments(this.$route.params.id);
|         else {

3 - Filen bearbetades med dessa laddare:

File was processed with these loaders:
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/ts-loader/index.js
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js
You may need an additional loader to handle the result of these loaders.
|         ...mapGetters(["currentUser"]),
|         userNameInitials() {
>             const userName = this.currentUser?.name;
|             let name = "";
|             if (userName) {

4 - Filen bearbetades med dessa laddare:

Module parse failed: Unexpected token (97:21)
File was processed with these loaders:
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/ts-loader/index.js
 * ./node_modules/eslint-loader/index.js
You may need an additional loader to handle the result of these loaders.
|             if (!e.objectIds)
|                 e.objectIds = [];
>             if (meta?.id)
|                 e.objectIds.push(meta.id);
|             e.objectId = meta ? meta.id : null;

Jag försökte leka med tsconfig men det hjälpte inte. Jag såg en artikel på Stack Overflow, och problemet är att koden inte kan kompileras. Och jag borde lägga till något i tsconfig-filen, men jag har ingen aning om vad.

Relaterade artiklar