NUXT_B5004

不支持外部配置文件

B5004

Nuxt 在你的 nuxt.config 附近发现了一个独立的 vite.config 或 webpack.config 文件。Nuxt 会在内部管理打包器,因此会忽略这些文件,所以它们通常是迁移后遗留的文件,或者是从非 Nuxt 项目中复制过来的。

从 vite-plus 导入内容的 vite.config 文件不会触发此警告,因为它配置的是 Vite+ 命令,而非 Nuxt 应用。

解决方案

将配置移到 nuxt.config 中对应的键下,然后删除外部文件:

  • vite.config:使用 vite 键
  • webpack.config:使用 webpack 键
  • nitro.config:使用 nitro 键
  • postcss.config:使用 postcss 键
export default defineNuxtConfig({
  vite: {
    // 你的 Vite 配置在这里
  },
})
在 Docs > Getting Started > Configuration 中查看详情

Was this helpful?