keanu-weblite/vite.config.mjs

65 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

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 { viteStaticCopy } from 'vite-plugin-static-copy';
2025-06-09 09:44:37 +02:00
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
2025-03-31 17:41:21 +02:00
2025-03-31 16:33:54 +02:00
// https://vitejs.dev/config/
export default defineConfig(({mode}) => ({
2025-05-19 16:56:55 +02:00
base: "./",
2025-03-31 16:33:54 +02:00
plugins: [
2025-06-09 09:44:37 +02:00
wasm(),
topLevelAwait(),
2025-05-14 10:47:21 +02:00
vue({
template: {
compilerOptions: {
comments: false
}
}
}),
2025-05-06 09:27:53 +02:00
vueJsx(),
vitePluginVuetify(),
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',
dest: mode == "development" ? '/node_modules/.vite/deps/pkg' : ''
2025-03-31 16:33:54 +02:00
}
]
}),
],
2025-06-12 12:00:43 +02:00
worker: {
format: "es",
plugins: () => [
wasm(),
topLevelAwait()
]
},
2025-03-31 16:33:54 +02:00
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)) },
2025-05-06 09:27:53 +02:00
{ find: "vue", replacement: fileURLToPath(new URL("./node_modules/vue/dist/vue.esm-bundler.js", import.meta.url)) },
],
2025-03-31 16:33:54 +02:00
},
2025-06-12 12:00:43 +02:00
build: {
assetsDir: "assets",
2025-06-09 09:44:37 +02:00
commonjsOptions: { transformMixedEsModules: true }
2025-07-15 14:19:17 +02:00
},
preview: {
port: 5173,
},
}));