tsconfig.json

Nuxt 会生成一个 .nuxt/tsconfig.json 文件,其中包含合理的默认值和你的别名。

Nuxt 自动生成 是一个 .nuxt/tsconfig.json 文件,其中包含你在 Nuxt 项目中使用的已解析别名以及其他合理的默认值。

¥Nuxt automatically generates a .nuxt/tsconfig.json file with the resolved aliases you are using in your Nuxt project, as well as with other sensible defaults.

你可以通过在项目根目录中创建包含以下内容的 tsconfig.json 来从中受益:

¥You can benefit from this by creating a tsconfig.json in the root of your project with the following content:

tsconfig.json
{
  "extends": "./.nuxt/tsconfig.json"
}
你可以根据需要自定义此文件的内容。但是,建议你不要覆盖 targetmodulemoduleResolution
如果你需要自定义 paths,这将覆盖自动生成的路径别名。我们建议你将所需的任何路径别名添加到 nuxt.config 中的 alias 属性中,它们将被提取并添加到自动生成的 tsconfig 中。