Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vite cannot handle xxx.html files

I had a Vite project for Vue2, It include a static html file.

like following

import template from 'editor.html';
export default {
    template: template
}

When I ran yarn dev, Terminal output:

node_modules/@gaoding/editor-framework/lib/base/editor.js:23:21: error: No loader is configured for ".html" files: node_modules/@gaoding/editor-framework/lib/base/editor.html 23 │ import template from './editor.html';

I tried to add some plugin below in vite.config.ts, But all of these didn't work.

@rollup/plugin-html

rollup-plugin-html

rollup-plugin-htmlvue

How can I solve this problem.

like image 676
noahlam Avatar asked Sep 13 '25 16:09

noahlam


1 Answers

adding ?raw at the end of the import can address the issue:

import template from "./contact-list.html?raw";  

I'm still looking for a solution how to set it globally for all HTML files.

like image 165
Marcin Wosinek Avatar answered Sep 15 '25 06:09

Marcin Wosinek