Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import HTML file using esbuild's text loader? #2767

Open
HcySunYang opened this issue Jul 17, 2024 · 0 comments
Open

How to import HTML file using esbuild's text loader? #2767

HcySunYang opened this issue Jul 17, 2024 · 0 comments

Comments

@HcySunYang
Copy link

ESbuild has a built-in text loader https://esbuild.github.io/content-types/#text, which allows us to load a file as a raw text string. So we are going to be able to load the HTML files as strings by making use of the text loader:

import content from './xxx.html'

But it will throw an error that says ERROR: No loader is configured for ".html" files: xxx.html, I looked into the source code, it seems because the lack of the loader configs:

image

There is no way to specify the text loader, so how can we achieve that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant