I am trying to generate index.html with Vite that has unescaped variable in src tag, but Vite is always escaping it
What I want is this:
<!DOCTYPE html> <html lang="en"> <head> <script type="module" src="/{{ variable }}/assets/index.js"></script> </head> <body> </body> </html>
But after building with Vite it is transformed to
<!DOCTYPE html> <html lang="en"> <head> <script type="module" src="/%7B%7B%20variable%20%7D%7D/assets/index.js"></script> </head> <body> </body> </html>
I am trying to accomplish that by setting base property in Vite configuration as follows
{ base: "/{{ variable }}" }
But obviously not working
I ended writing my own plugin, something like that: