import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue2"; import { fileURLToPath, URL } from "node:url"; import Components from "unplugin-vue-components/vite"; import { viteStaticCopy } from 'vite-plugin-static-copy'; import nodePolyfills from 'rollup-plugin-polyfill-node'; function VuetifyResolver() { return { type: 'component', resolve: (name) => { if (name.match(/^V[A-Z]/) && !name.includes("VEmojiPicker")) return { name, from: 'vuetify/lib' } }, } } // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), Components({ resolvers: [VuetifyResolver()], }), viteStaticCopy({ targets: [ { src: "src/assets/config.json", dest: '' }, { src: "node_modules/@matrix-org/olm/olm.wasm", dest: '' }, { src: 'node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm', dest: '/node_modules/.vite/deps/pkg' } ] }), nodePolyfills() ], resolve: { extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue", ".wasm"], alias: { "@": fileURLToPath(new URL("./src", import.meta.url)), "~@": fileURLToPath(new URL("./src", import.meta.url)), "~vuetify": fileURLToPath(new URL("./node_modules/vuetify", import.meta.url)), }, }, define: { global: "window", Lame: "window.Lame", Presets: "window.Presets", GainAnalysis: "window.GainAnalysis", QuantizePVT: "window.QuantizePVT", Quantize: "window.Quantize", Takehiro: "window.Takehiro", Reservoir: "window.Reservoir", MPEGMode: "window.MPEGMode", BitStream: "window.BitStream", }, });