vite-plugin-html-env icon indicating copy to clipboard operation
vite-plugin-html-env copied to clipboard

Plugin conflicts with vite-plugin-pwa

Open TheDutchCoder opened this issue 3 years ago • 4 comments

I'm not sure what the cause is, but I have the feeling that the html file isn't fully written yet by the time the vite-plugin-pwa starts to work on it.

Does it maybe need to await certain processes to finish?

TheDutchCoder avatar Jul 15 '22 13:07 TheDutchCoder

Can you provide a code snippet?

lxs24sxl avatar Jul 25 '22 05:07 lxs24sxl

Is the cached resource still being accessed after the vite.config.js file is modified? On my side it is fine when I use vite-plugin-pwa.

lxs24sxl avatar Jul 25 '22 07:07 lxs24sxl

I have stopped using the plugin, but I think the cause was that the plugin didn't actually pick up <%=VITE_VAR%> properly when it wasn't inside of an existing tag and therefore the PWA plugin would trip in invalid HTML.

Something like this:

<html>
  <head>
    <meta content="<%=VITE_THIS_WORKS" />
    <%=VITE_THIS_DOES_NOT%>
  </head>
  <body>
  </body>
</html>

TheDutchCoder avatar Jul 25 '22 12:07 TheDutchCoder

Maybe you can use version 1.2.3, I debugged this version is no problem.

<html>
  <head>
    <meta content="<%= VITE_THIS_WORKS %>" />
  </head>
  <body>
  </body>
</html>

lxs24sxl avatar Jul 27 '22 03:07 lxs24sxl