2025-03-31 16:33:54 +02:00
|
|
|
import { defineConfig } from "vite";
|
2025-05-06 09:27:53 +02:00
|
|
|
import vue from "@vitejs/plugin-vue";
|
|
|
|
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
|
|
|
import vitePluginVuetify from "vite-plugin-vuetify";
|
2025-03-31 16:33:54 +02:00
|
|
|
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';
|
2025-04-22 13:01:18 +02:00
|
|
|
import { resolve } from "path";
|
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
2025-03-31 16:33:54 +02:00
|
|
|
|
2025-03-31 17:41:21 +02:00
|
|
|
function VuetifyResolver() {
|
|
|
|
|
return {
|
|
|
|
|
type: 'component',
|
|
|
|
|
resolve: (name) => {
|
2025-05-06 09:27:53 +02:00
|
|
|
console.log("rESOLVE", name);
|
2025-03-31 17:41:21 +02:00
|
|
|
if (name.match(/^V[A-Z]/) && !name.includes("VEmojiPicker"))
|
2025-05-06 09:27:53 +02:00
|
|
|
return { name, from: './node_modules/vuetify/lib/components' }
|
2025-03-31 17:41:21 +02:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-31 16:33:54 +02:00
|
|
|
// https://vitejs.dev/config/
|
2025-04-22 13:01:18 +02:00
|
|
|
export default defineConfig(({mode}) => ({
|
2025-03-31 16:33:54 +02:00
|
|
|
plugins: [
|
2025-04-22 13:01:18 +02:00
|
|
|
// commonjs({
|
|
|
|
|
// include: /node_modules/,
|
|
|
|
|
// requireReturnsDefault: 'auto', // <---- this solves default issue
|
|
|
|
|
// }),
|
|
|
|
|
// commonjs({
|
|
|
|
|
// exclude: ["*vuex-persist*", "*deepmerge*"]
|
|
|
|
|
// }),
|
2025-03-31 16:33:54 +02:00
|
|
|
vue(),
|
2025-05-06 09:27:53 +02:00
|
|
|
vueJsx(),
|
|
|
|
|
vitePluginVuetify(),
|
|
|
|
|
// Components({
|
|
|
|
|
// resolvers: [VuetifyResolver()],
|
|
|
|
|
// }),
|
2025-03-31 16:33:54 +02:00
|
|
|
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',
|
2025-04-22 13:01:18 +02:00
|
|
|
dest: mode == "development" ? '/node_modules/.vite/deps/pkg' : ''
|
2025-03-31 16:33:54 +02:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}),
|
2025-04-22 13:01:18 +02:00
|
|
|
//nodePolyfills(),
|
2025-03-31 16:33:54 +02:00
|
|
|
],
|
|
|
|
|
resolve: {
|
2025-04-22 13:01:18 +02:00
|
|
|
extensions: ['.vue','.mjs', '.js', '.ts', '.jsx', '.tsx', '.json','.wasm'],
|
|
|
|
|
alias: [
|
|
|
|
|
{ find: "@", replacement: fileURLToPath(new URL("./src", import.meta.url)) },
|
|
|
|
|
{ find: "~@", replacement: fileURLToPath(new URL("./src", import.meta.url)) },
|
2025-05-06 09:27:53 +02:00
|
|
|
{ find: "~vuetify/src", replacement: fileURLToPath(new URL("./node_modules/vuetify/lib", import.meta.url)) },
|
|
|
|
|
{ find: "vue", replacement: fileURLToPath(new URL("./node_modules/vue/dist/vue.esm-bundler.js", import.meta.url)) },
|
2025-04-22 13:01:18 +02:00
|
|
|
],
|
2025-03-31 16:33:54 +02:00
|
|
|
},
|
|
|
|
|
define: {
|
2025-04-22 13:01:18 +02:00
|
|
|
//global: "window",
|
|
|
|
|
//module: {},
|
2025-03-31 16:33:54 +02:00
|
|
|
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",
|
|
|
|
|
},
|
2025-04-22 13:01:18 +02:00
|
|
|
build: {
|
|
|
|
|
commonjsOptions: { transformMixedEsModules: true } // Change
|
|
|
|
|
}
|
|
|
|
|
// optimizeDeps: {
|
|
|
|
|
// include: ["deepmerge", "vuex-persist"],
|
|
|
|
|
// },
|
|
|
|
|
// optimizeDeps: {
|
|
|
|
|
// include: [
|
|
|
|
|
// "vuex-persist", "vue-sanitize"
|
|
|
|
|
// ],
|
|
|
|
|
// esbuildOptions:{
|
|
|
|
|
// plugins:[
|
|
|
|
|
// commonjs()
|
|
|
|
|
// ]
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// build: {
|
|
|
|
|
// commonjsOptions: {
|
|
|
|
|
// include: [/node_modules/],
|
|
|
|
|
// requireReturnsDefault: true,
|
|
|
|
|
// exclude: ["vuex-persist"]
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// rollupOptions: {
|
|
|
|
|
// //Here, we are externalizing Vue to prevent it to be bundled
|
|
|
|
|
// //with our library
|
|
|
|
|
// external: ["vue"],
|
|
|
|
|
// //Add this so the UMD build will recognize the global variables
|
|
|
|
|
// //of externalized dependencies
|
|
|
|
|
// output: {
|
|
|
|
|
// globals: {
|
|
|
|
|
// vue: "Vue",
|
|
|
|
|
// },
|
|
|
|
|
// exports: "named",
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
}));
|