Fix vite build release version

Also, make sure "export" strings are not removed (rename to "room_export") and import quotes in the QuoteView correctly.
This commit is contained in:
N-Pex 2025-04-22 13:01:18 +02:00
parent 4c364f93e6
commit ec992bb14d
34 changed files with 621 additions and 284 deletions

View file

@ -4,6 +4,8 @@ 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';
import { resolve } from "path";
import commonjs from '@rollup/plugin-commonjs';
function VuetifyResolver() {
return {
@ -16,8 +18,15 @@ function VuetifyResolver() {
}
// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({mode}) => ({
plugins: [
// commonjs({
// include: /node_modules/,
// requireReturnsDefault: 'auto', // <---- this solves default issue
// }),
// commonjs({
// exclude: ["*vuex-persist*", "*deepmerge*"]
// }),
vue(),
Components({
resolvers: [VuetifyResolver()],
@ -34,22 +43,23 @@ export default defineConfig({
},
{
src: 'node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm',
dest: '/node_modules/.vite/deps/pkg'
dest: mode == "development" ? '/node_modules/.vite/deps/pkg' : ''
}
]
}),
nodePolyfills()
//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)),
},
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: "~vuetify", replacement: fileURLToPath(new URL("./node_modules/vuetify", import.meta.url)) },
],
},
define: {
global: "window",
//global: "window",
//module: {},
Lame: "window.Lame",
Presets: "window.Presets",
GainAnalysis: "window.GainAnalysis",
@ -60,4 +70,40 @@ export default defineConfig({
MPEGMode: "window.MPEGMode",
BitStream: "window.BitStream",
},
});
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",
// },
// },
}));