You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a script surrounded by comments in the body of index.html in your Vue3 app
<html><head>…</head><body><divid="app"></div><scripttype="module" src="/src/main.ts"></script><!-- GA4 --><!-- Google Tag Manager --><scripttype="text/plain" cookie-consent="tracking">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
newDate().getTime(),event:'gtm.js'});varf=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-XXXXXXX');</script><noscript><iframesrc="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe></noscript><!-- End Google Tag Manager --><!-- end of GA4--></body></html>
Setup the plugin with its default configuration in vite.config.ts:
Run a production build and look into dist/index.html.
Actual result:
The whole block beginning with <!-- GA4 --> and ending with <!-- end of GA4--> has been removed from the built index.html.
Expected result:
The whole block beginning with <!-- GA4 --> and ending with <!-- end of GA4-->should not be removed from the built index.html.
The text was updated successfully, but these errors were encountered:
oquas
changed the title
Scripts surrounded by comments in markup get stripped during buidl
Scripts surrounded by comments in markup get stripped during build
Jun 15, 2023
Hey there,
i just found a bug i want to communicate here.
Steps to reproduce:
Add a script surrounded by comments in the
body
ofindex.html
in your Vue3 appSetup the plugin with its default configuration in
vite.config.ts
:Run a production build and look into
dist/index.html
.Actual result:
The whole block beginning with
<!-- GA4 -->
and ending with<!-- end of GA4-->
has been removed from the builtindex.html
.Expected result:
The whole block beginning with
<!-- GA4 -->
and ending with<!-- end of GA4-->
should not be removed from the builtindex.html
.The text was updated successfully, but these errors were encountered: