Vite – change ouput directory of assets

The output filenames are configured in Rollup with build.rollupOptions: Set output.assetFileNames to configure the asset filenames (for media files and stylesheets). Set output.chunkFileNames to configure the vendor chunk filenames. Set output.entryFileNames to configure the index.js filename. // vite.config.js import { defineConfig } from ‘vite’; import react from ‘@vitejs/plugin-react’; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], … Read more

Vue 3 Vite – dynamic image src

Update 2022: Vite 3.0.9 + Vue 3.2.38 Solutions for dynamic src binding: 1. With static URL <script setup> import imageUrl from ‘@/assets/images/logo.svg’ // => or relative path </script> <template> <img :src=”imageUrl” alt=”img” /> </template> 2. With dynamic URL & relative path <script setup> const imageUrl = new URL(`./dir/${name}.png`, import.meta.url).href </script> <template> <img :src=”imageUrl” alt=”img” /> … Read more