html - vite 无法处理 xxx.html 文件
问题描述
我有一个 Vue2 的 Vite 项目,它包含一个静态 html 文件。
喜欢以下
import template from 'editor.html';
export default {
template: template
}
当我运行yarn dev
时,终端输出:
node_modules/@gaoding/editor-framework/lib/base/editor.js:23:21:错误:没有为“.html”文件配置加载器:node_modules/@gaoding/editor-framework/lib/base/editor.html 23 │ 从 './editor.html' 导入模板;
我试图在下面添加一些插件vite.config.ts
,但所有这些都不起作用。
@rollup/plugin-html
汇总插件 html
汇总插件 htmlvue
我怎么解决这个问题。
解决方案
?raw
在导入结束时添加可以解决问题:
import template from "./contact-list.html?raw";
我仍在寻找如何为所有 HTML 文件全局设置它的解决方案。
推荐阅读
- machine-learning - 二进制分类问题:如何处理严重的数据不平衡?
- rest - 关于 REST 请求和响应中的 Content-Type 标头的问题
- exchange-server - 邮件递送限制
- php - Lighttpd:我可以将 http 错误响应重定向到 error.php 处理程序吗?
- mysql - 在 MySQL 中有条件地在列中插入值
- ibm-doors - DXL 显示输出但未反映在列中
- amazon-ec2 - 错误:sudo:amazon-linux-extras:找不到命令
- amazon-web-services - 如何使用 Terraform 从 gitlab 存储库归档文件/目录?
- label - 泰勒图上的标签
- android - 图像文本识别检测 Flutter 中的特定字体