How to write a plugin that handles import
to *.html
files?
#20307
Unanswered
miguel-leon
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I created and added (installed?) a plugin with
enforce: 'pre'
, with which I hope toresolveId
orload
ids that end with.html
, instead of whatever vite does with them.To my understanding, with
enforce: 'pre'
my plugin will run first than "Vite core plugins", yet I get an error:[vite] (client) Pre-transform error: Failed to parse source for import analysis because the content contains invalid JS syntax. You may need to install appropriate plugins to handle the .html file format, or if it's an asset, add "**/*.html" to
assetsIncludein your configuration.
.Do I need to configure something else or is this a bug?
Also, these
.html
ids that Iimport
(in js/ts files), are not passed bytransformIndexHtml
invite dev
, but are passed duringvite build
.Why the difference? I can't find documentation about this.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions