I recently ran into a configuration issue with my vite-config.ts file.
export default defineConfig({
...
define: {
__PRODUCT__: JSON.stringify("My Product")
}
In my vue sfc template, I have the following code snippet:
<div class="footer">
{{ __PRODUCT__ }}
</div>
Despite setting up the configuration correctly, I encountered an error stating
Property '__PRODUCT__' does not exist on type...
To resolve this issue, I had to include the following code in the <script>
section:
let product = __PRODUCT__
After making this adjustment, I was able to use {{product}}
in the template successfully, although I am still unsure why it was necessary.