-
I've been struggling to use Vite to inline the javascripts/stylesheets, especially for:
For all those purposes it is desired to inline the full Javascript/Stylesheet source. We've dabbled around with:
This seems to work for the stylesheets so far, but the javascript is difficult to inline, because of ESM, wrapping it with a script produces Has any of you any experience successfully inlining the Javascript? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi Stefan! @zealot128 Regarding the styles for mailers, using I assume inlining JS is only relevant for the third use case:
Could you elaborate on why is it desirable to inline the JS? The following error suggests that you are combining separate ESM files into a single one:
Combining modules into a single file is not a trivial task and requires full analysis, a task that is perfect for Rollup (Vite). Alternatively, you could use one of these hacks to inline each file separately. I'd recommend experimenting by either:
You can toggle between a normal build and an iife build by using environment variables within your |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Hi Stefan! @zealot128
Regarding the styles for mailers, using
premailer-rails
might also be a good option.I assume inlining JS is only relevant for the third use case:
Could you elaborate on why is it desirable to inline the JS?
The following error suggests that you are combining separate ESM files into a single one:
Combining modules into a single file is not a trivial task and requires full analysis, a task that is perfect for Rollup (Vite). Alternatively, you could use one of these hacks to inline each file separately.
I'…