import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import legacy from '@vitejs/plugin-legacy'; function handleModuleDirectivesPlugin() { return { name: 'handle-module-directives-plugin', transform(code: string, id: string) { if (id.includes('@vkontakte/icons')) { code = code.replace(/"use-client";?/g, ''); } return { code }; }, }; } /** * Some chunks may be large. * This will not affect the loading speed of the site. * We collect several versions of scripts that are applied depending on the browser version. * This is done so that your code runs equally well on the site and in the odr. * The details are here: https://dev.vk.ru/mini-apps/development/on-demand-resources. */ export default defineConfig({ base: './', plugins: [ react(), handleModuleDirectivesPlugin(), legacy({ targets: ['defaults', 'not IE 11'], }), ], build: { outDir: 'build', }, });