【问题标题】:TypeScript and tsconfig.json file for NuxtJSNuxtJS 的 TypeScript 和 tsconfig.json 文件
【发布时间】:2018-07-12 09:28:00
【问题描述】:

我有一个带有 NuxtJS在 ./src/client/ 中)和 NestJS在 ./src/ 中)的项目服务器/)。

NuxtJStsconfig.jsontsconfig.json 的扩展,适用于全球项目。

我不知道如何才能对项目进行操作。

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

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

使用 { runInNewContext: false 时,bundle export 应该是一个函数 }。

如果我在我的项目中删除所有 NestJS 的痕迹,NuxtJS 启动良好,但是当我在 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"
  ]
}

【问题讨论】:

    标签: typescript nuxt.js


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2017-01-15
      • 1970-01-01
      • 2016-01-16
      • 2017-02-13
      • 2022-08-16
      • 2016-02-05
      • 2018-01-15
      • 2022-06-25
      • 2020-09-10
      相关资源
      最近更新 更多