请问这个问题是怎么解决的

Two output files share the same path but have different contents: node_modules.vite\deps_temp\Vue.js

img

这个报错是因为同插件重复命名
例如:
导入vuex 时将V大写 import xxx from 'Vuex'
此时根目录下node_modules.vite\deps文件夹 创建了vueX.js
改回import xxx from 'vuex' 此时又小写v
报错Two output files share the same path but have different contents:node_modules.vite\processing

检查一下代码中的import,把node_modules.vite\deps下的文件删除,再试下

该回答引用GPTᴼᴾᴱᴺᴬᴵ
这个问题通常发生在使用 Vite 构建 Vue.js 应用程序时,Vite 默认会将 Vue.js 作为依赖项进行编译,并将编译后的文件存储在 node_modules.vite\deps_temp\Vue.js 目录下。

如果在你的项目中有一个自定义的 Vue.js 文件,并且它与 Vite 默认的 Vue.js 文件存在冲突,则会发生该问题。两个输出文件将尝试保存到同一个路径,但内容不同,因此会产生冲突。

为了解决这个问题,你可以尝试以下方法:

  1. 确保你的自定义 Vue.js 文件的命名不同于 Vite 默认的 Vue.js 文件,例如将其命名为 MyVue.js。

  2. 在你的 Vite 配置文件中指定自定义的 Vue.js 文件,以便 Vite 编译器使用你的自定义文件而不是默认的 Vue.js 文件。例如,在 vite.config.js 文件中添加以下代码:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: tag => tag === 'my-component'
        }
      }
    })
  ],
  resolve: {
    alias: {
      'vue$': 'path/to/MyVue.js'
    }
  }
})


在这个例子中,'vue$': 'path/to/MyVue.js' 将指定 Vite 使用你的自定义 Vue.js 文件。

希望这可以帮助你解决问题!

重新安装一下依赖