NuxtJS 的 TypeScript 和 tsconfig.json 文件

TypeScript and tsconfig.json file for NuxtJS

我有一个使用 NuxtJSin ./src/client/)和 NestJS在./src/server/)。

tsconfig.json for NuxtJStsconfig.json[=41 的扩展=] 用于全球项目。

我不知道如何才能完成项目。

https://github.com/pirmax/nuxt-and-nest/tree/develop

当我转到根页面时,NuxtJS 出现错误:

bundle export should be a function when using { runInNewContext: false }.

如果我在我的项目中删除所有 NestJS 的痕迹,NuxtJS 启动良好,但是当我在 [=33 中添加我的配置时=]tsconfig.json,项目给我这个错误。

我的 tsconfig.json 在 ./src/client/

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "rootDir": ".",
    "target": "es5",
    "lib": ["dom", "es2015"],
    "module": "es2015",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "noImplicitAny": false,
    "noImplicitThis": false,
    "strictNullChecks": true,
    "removeComments": true,
    "suppressImplicitAnyIndexErrors": true,
    "allowSyntheticDefaultImports": true,
    "allowJs": true,
    "baseUrl": ".",
    "paths": {
      "~/*": ["./*"]
    }
  }
}

我的 tsconfig.json 在 ./ (root)

{
  "compilerOptions": {
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "lib": ["es2015"],
    "target": "es5",
    "sourceMap": true,
    "allowJs": true,
    "outDir": "./dist",
    "baseUrl": ".",
    "paths": {
      "~/*": [
        "./*"
      ],
      "@app/*": [
        "./src/client/*"
      ],
      "@server/*": [
        "./src/server/*"
      ]
    }
  },
  "include": [
    "src/server/**/*"
  ],
  "exclude": [
    "node_modules",
    "**/*.spec.ts"
  ]
}

Here 是我放在一起的示例,它展示了 Typescript 与 Nuxt 的结合使用。