Conflict: Multiple assets emit different content to the same filename index.html

2,711 阅读1分钟

运行npm run serve报错:

error

Conflict: Multiple assets emit different content to the same filename index.html

ERROR in Conflict: Multiple assets emit different content to the same filename index.html

webpack compiled with 1 error

冲突中的错误:多个资产向相同的文件名 index.html 发出不同的内容

产生原因:

一、 项目路径中存在中文名

二、 使用基架创建项目时,多个文件的名称重复。

解决方法:

一、 改纯英文路径名

二、 修改相关的 webpack 配置文件:

  1. 把 index.html 文件重命名为 index.ejs 文件;
  2. 在 node_nodules/webpack/bin/webpack.js 中加入 html: { template: './src/index.ejs' }
  3. 重新运行npm run serve

uTools_1678976830761.png