Replies: 4 comments 2 replies
-
I met the same problem... -_- |
Beta Was this translation helpful? Give feedback.
-
Since v5 you can opt-out of HTML processing by adding the attribute |
Beta Was this translation helpful? Give feedback.
-
So, is this not solved? |
Beta Was this translation helpful? Give feedback.
-
Also, check if adding the type="module" attribute explicitly to the script tag helps during the build process, as sometimes Vite’s optimizer behaves differently based on script types. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Due to an issue apparently related to Stencil, I'm forced to load a component library using a direct import in
index.html
file.This works great in dev mode (running
npm run dev
). But when I build the app (npm run build
), Vite bundles this script and remove the static import fromdist/index.html
. And, as it cannot bundle it properly, the dependency does not work: I have console errors in my browser.How can I tell vite to ignore this script and just keep the import as-is?
I tried
optimzeDeps.exclude
(before I read it's only applied to dev mode),build.commonjsOptions.exclude
,build.rollupOptions.external
, without success for now.Beta Was this translation helpful? Give feedback.
All reactions