keanu-weblite/vite.config.mjs
2025-06-10 16:51:57 +02:00

54 lines
1.6 KiB
JavaScript

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import vitePluginVuetify from "vite-plugin-vuetify";
import { fileURLToPath, URL } from "node:url";
import { viteStaticCopy } from 'vite-plugin-static-copy';
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
// https://vitejs.dev/config/
export default defineConfig(({mode}) => ({
base: "./",
plugins: [
wasm(),
topLevelAwait(),
vue({
template: {
compilerOptions: {
comments: false
}
}
}),
vueJsx(),
vitePluginVuetify(),
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: mode == "development" ? '/node_modules/.vite/deps/pkg' : ''
}
]
}),
//nodePolyfills(),
],
resolve: {
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)) },
{ find: "vue", replacement: fileURLToPath(new URL("./node_modules/vue/dist/vue.esm-bundler.js", import.meta.url)) },
],
},
build: {
commonjsOptions: { transformMixedEsModules: true }
}
}));